Hello all,
I have been googling topic about logrotate on logstash file, such as logstash.log and logstash.stdout, for some reason I couldn't make logrotate working.
My logstash.log and logstash.stdout are pretty intensive, the size that is created in minute are quite big. For logstash.log, every 2 minutes it create approximately 40M, while for logstash.stdout is 90M.
I have logstash configuration for logrotate as follows:
/var/log/logstash/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
sharedscripts
postrotate
/sbin/service logstash restart > /dev/null
endscript
}
When I ran it manually from command line as the following:
logrotate -vdf /etc/logrotate.conf
I got the following error:
...
rotating pattern: /var/log/logstash/*.log forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/logstash/logstash.log
log needs rotating
rotating log /var/log/logstash/logstash.log, log->rotateCount is 7
dateext suffix '-20150611'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
glob finding old rotated logs failed
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/logstash/logstash.log to /var/log/logstash/logstash.log-20150611
creating new /var/log/logstash/logstash.log mode = 0644 uid = 996 gid = 995
running postrotate script
running script with arg /var/log/logstash/*.log : "
/sbin/service logstash restart > /dev/null
"
...
If I removed postrotate ... endscript, I got the following message:
rotating pattern: /var/log/logstash/*.log forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/logstash/logstash.log
log needs rotating
rotating log /var/log/logstash/logstash.log, log->rotateCount is 7
dateext suffix '-20150611'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
glob finding old rotated logs failed
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/logstash/logstash.log to /var/log/logstash/logstash.log-20150611
creating new /var/log/logstash/logstash.log mode = 0644 uid = 996 gid = 995
But the logstash.log file was not reset to zero size file, and no new file such as /var/log/logstash/logstash.log-20150611 was created.
Please share your knowledge and experience if you encountered this issue before.
Thanks!
-Laurentius