Skip to content

Instantly share code, notes, and snippets.

@marinsagovac
Created December 15, 2017 10:50
Show Gist options
  • Save marinsagovac/d2d71976ba4dc488fb0a87c8d507f65c to your computer and use it in GitHub Desktop.
Save marinsagovac/d2d71976ba4dc488fb0a87c8d507f65c to your computer and use it in GitHub Desktop.
Logrotate unix
LOGROTATE CENTOS
================
INFO
====
Check is logrotate active:
cat /etc/cron.daily/logrotate
A log rotate command is:
/usr/sbin/logrotate
Example of script that executes by daily:
/etc/cron.daily/logrotate
Main log configuration
=======================
cat /etc/logrotate.conf
A typical logrotate for HTTP server is under:
cat /etc/logrotate.d/httpd
Add custom log into HTTP service
================================
vi /etc/logrotate.d/httpd
Add a custom log:
/var/www/html/*log {
minsize 50M
rotate 4
create
missingok
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment