Created
June 12, 2010 03:04
-
-
Save aputs/435360 to your computer and use it in GitHub Desktop.
logrotate config for nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/var/log/nginx_*.log { | |
daily | |
compress | |
delaycompress | |
rotate 2 | |
missingok | |
nocreate | |
sharedscripts | |
postrotate | |
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid` | |
endscript | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/var/log/php-fpm.log { | |
daily | |
compress | |
delaycompress | |
rotate 2 | |
missingok | |
notifempty | |
create 644 root root | |
sharedscripts | |
postrotate | |
/sbin/service php-fpm flush-logs > /dev/null | |
endscript | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#keep a whole year of logs | |
#rename logs to %Y%m%d/+%Y%m%d.access | |
/var/log/smartwap/access.log { | |
daily | |
nocompress | |
rotate 365 | |
missingok | |
nocreate | |
sharedscripts | |
postrotate | |
FNAME=`echo $1 | sed -e 's/ *$//'`.1 | |
DIR=`dirname $FNAME`/`date --date='-1 day' +%Y%m` | |
EXT=`basename $1 | cut -d'.' -f1` | |
DEST=$DIR/`date --date='-1 day' +%Y%m%d`.$EXT | |
mkdir -p $DIR | |
mv $FNAME $DEST | |
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid` | |
endscript | |
} | |
#error logs | |
/var/log/smartwap/error.log { | |
daily | |
compress | |
delaycompress | |
rotate 2 | |
missingok | |
nocreate | |
postrotate | |
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid` | |
endscript | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment