Re: Silly logrotate question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 10/19/2011 05:14 AM, John Kennedy wrote:
> How can I satisfy both the need to remove yesterday's log file while keeping
> the current day?

Hi,

I perfectly understand your problem.  "copytruncate" is not your friend
here so, taking "copytruncate" out of the picture, I really don't see a
quick fix as logrotate doesn't provide a facility to work on files OLDER
than X days.  If there was such an option, you could tell it to rotate
all the *.log files from the previous day (move them & compress, not
copy them) without affecting your current day log.

Possible workarounds:

1) Modify your app if you can so that it stops creating new files daily.
 Something like app.log.

Use the "copytruncate"  &  "dateext" (along with your other options)  in
the logrotate configuration so that every day the file is COPIED &
COMPRESSED to app.log.20111119.gz.   That way your file is truncated
everyday and you'll have nicely compressed historical archives (with the
date appended) which you can keep for X days depending on your "rotate
X" value.

2) get creative with the "prerotate" and "postrate" options of logrotate.

3)  if your app is smart enough to create a log daily perhaps you could
tell it to compress the previous file and get rid of logrotate for that.


HTH,
Jorge
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux