[Ilugc] logrotate compress issue

  • From: knura9@xxxxxxxxx (Arun Khan)
  • Date: Wed, 11 Nov 2015 12:47:16 +0530

On Wed, Nov 11, 2015 at 1:33 AM, Ajeesh Kannan <ajeeshbkannan at gmail.com> 
wrote:

H,

i have added  logrotate as follows,

log.* {
        daily
        missingok
        rotate 2
        dateext
        dateformat %Y-%m-%d.
        compress
        maxage 40
}

But now the zipped logs are again and again zipping.

.gz-20151011.gz2015-11-10..gz

Can you check anything wrong in my logrotating

I don't think the above will work.  "log.*" wildcard matches the
compressed files also.  So change the regex or specify the log file's
complete name.

Also, logrotate would need some finite amount of time to rename the
current log file and replace it with a 0 length logfile for the daemon
to log.

If your daemon supports a SIGHUP, then it might be worhtwile to do a
postrotate SIGHUP so that the daemon starts logging on the new file.
Also, try delaycompress in conjuction with compress.  For more
details,  RTFM   "man logrotate."

You may have to experiment with the logrotate options to get what you want.

Just a thought, if your distro is a RHEL/derivative check for SELinux gotchas.

It would be great if you could share your solution.

HTH,
-- Arun Khan

Other related posts: