[Ilugc] logrotate compress issue

  • From: ajeeshbkannan@xxxxxxxxx (Ajeesh Kannan)
  • Date: Wed, 11 Nov 2015 17:03:38 +0530

On Wed, Nov 11, 2015 at 12:47 PM, Arun Khan <knura9 at gmail.com> wrote:

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
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines



Thank you for your update.

I am keeping 90 logs like :
message.log.1
message.log.2
message.log.3
.
.
message.log.90

and I need to keep two archive files for every log for 40 days files. But
now the logrotate
log.* {

option is taking "message.log.3.gz" files also in the next logrotate cycle.

I need to exclude the .gz files rotation.

-- 
With Regards,
Ajeesh B.Kannan

Other related posts: