Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to logrotate openstack logs based on size ?

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 file 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

How to logrotate openstack logs based on size ?

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 $cat /etc/logrotate.d/neutron
/var/log/neutron/*.log { size 200M missingok {
size 200M
missingok
rotate 7 compress notifempty nocreate 7
compress
notifempty
nocreate
}

The entry in cron tab looks something like below,

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