How to logrotate openstack logs based on size ?

asked 2014-08-08 05:23:03 -0500

praveen-sm-kumar gravatar image

updated 2014-08-08 05:31:09 -0500

I know openstack uses logrotate feature of linux to rotate logs. I want to rotate logs when the size of file exceeds 500MB. For this we can use 'size' parameter of logrotate however the logrotation will be triggered daily by default. is it possible to logrotate immediately after the file size exceeds 500MB. Currently I am running a cron job to execute the below command which rotates the log once every hour.

My logrotate.d directory contains file named 'neutron' which looks like below,

$cat /etc/logrotate.d/neutron
/var/log/neutron/*.log {
size 200M
missingok
rotate 7
compress
notifempty
nocreate
}

The entry in cron tab looks something like below,

0 * * * * /usr/sbin/logrotate /etc/logrotate.conf

edit retag flag offensive close merge delete

Comments

Not really an openstack question, you may want to search/ask also on logrotate-based forums.

smaffulli gravatar imagesmaffulli ( 2014-08-08 15:19:08 -0500 )edit