Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis logrotate config

Does anyone have a sample logrotate config for redis? This is what I have so far

/var/log/redis/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                ...
        endscript
}

But I'm not sure what to do on the postrotate step. This is on Ubuntu 10.04 LTS.

like image 973
Simian Avatar asked Mar 31 '11 06:03

Simian


2 Answers

This will probably suffice:

/var/log/redis/*.log {
       weekly
       rotate 10
       copytruncate
       delaycompress
       compress
       notifempty
       missingok
}
like image 148
Simian Avatar answered Sep 21 '22 15:09

Simian


I went with

/var/log/redis/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 0660 redis redis
}

because I don't want copytruncate.

I'm not sure the create line is necessary. It matches the file mode and ownership of the log files typically created by redis-server on Ubuntu (or Debian).

like image 36
Marius Gedminas Avatar answered Sep 21 '22 15:09

Marius Gedminas