[CentOS] Sort logfiles at rotation time
jorge.fabregas at gmail.com
Mon Nov 9 14:29:51 UTC 2009
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:
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).
More information about the CentOS