We have our the logrotate config for a service as below:
{
rotate 30
create 644 root syslog
missingok
notifempty
daily
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript }
Even though compress
is not mentioned in the config, the log files are gzipped after each rotation. I believe it is because the compress
line is uncommented in the /etc/logrotate.conf file, there by enabling it globally. The questions are:
Is there a time delay or interval between the log file is rotated, (from debug.log to debug.log-20190315) and when it is compressed (from debug.log-20190315 to debug.log-20190315.gz)?
If there is a delay, would mentioning
compress
in the specific log rotate config file of the service would compress that log file immediately after rotating it to debug.log-20190315 from debug.log ?
I do not see delaycompress
mentioned in any of the logrotate config files.
(Background: Our Splunk Indexer seems to be indexing a debug.log-2019xxxx file from this service. We have blacklisted *.gz$
and debug.log$
from going to the Splunk, but it seems that the file debug.log-2019xxxx exists for a few seconds or minutes because of which it gets forwarded to Splunk since during that time it does not match the blacklisted regex - *.gz$
and debug.log$
. I know that I can fix this by adding debug.log-[0-9]*
to the blacklist, but would like to know what causes the existence of xxxxxx.debug.log-20190315)