Re: Sort logfiles at rotation time

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



On Monday 09 November 2009 10:00:32 am Stephen Nelson-Smith wrote:
> I want to be certain that my apache and varnish logfiles are in strict
> date order when rotated.  I'd like to run a sort command against them
> before they're compressed.

I use the dateext option in my logrotate configuration file so that rotated 
files have the date appended to the filename.  I also compress them so they 
end up like:

whatever-site-access.log.20090930.gz
whatever-site-access.log.20091031.gz
whatever-site-error.log.20090930.gz
whatever-site-error.log.20091031.gz

Well...these are sorted (within the same type of file: access... error). If 
you want them strictly sorted by date you'll need to investigate.  I'm not 
sure if logrotate provides any facility in order to manipulate the "current" 
file being rotated so maybe you'll have to do this via a shells cript & cron 
(after logs are rotated).


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