Skip to content

Instantly share code, notes, and snippets.

@aputs
Created June 12, 2010 03:04
Show Gist options
  • Save aputs/435360 to your computer and use it in GitHub Desktop.
Save aputs/435360 to your computer and use it in GitHub Desktop.

Revisions

  1. aputs revised this gist Jul 5, 2010. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions logrotate-smartwap
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@
    sharedscripts
    postrotate
    FNAME=`echo $1 | sed -e 's/ *$//'`.1
    DIR=`date --date='-1 day' +%Y%m`
    DIR=`dirname $FNAME`/`date --date='-1 day' +%Y%m`
    EXT=`basename $1 | cut -d'.' -f1`
    DEST=`dirname $FNAME`/$DIR/`date --date='-1 day' +%Y%m%d`.$EXT
    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`
    @@ -29,4 +29,4 @@
    postrotate
    test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
    endscript
    }
    }
  2. aputs created this gist Jun 12, 2010.
    12 changes: 12 additions & 0 deletions logrotate-nginx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    /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
    }
    13 changes: 13 additions & 0 deletions logrotate-php-fpm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    /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
    }
    32 changes: 32 additions & 0 deletions logrotate-smartwap
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #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=`date --date='-1 day' +%Y%m`
    EXT=`basename $1 | cut -d'.' -f1`
    DEST=`dirname $FNAME`/$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
    }