Re: Logrotate - daily log files for a month

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

 



On Thu, 2007-08-23 at 15:17 -0500, Mikkel L. Ellertson wrote:
> Mikkel L. Ellertson wrote:
> > John Horne wrote:
> >> On Thu, 2007-08-23 at 09:58 -0500, Mikkel L. Ellertson wrote:
> >>> You can control how many old log files are kept by changing "rotate
> >>> 4" to how many weeks of backlogs you want to keep, This is in
> >>> /etc/logrotate.conf. You can control individual logs by editing the
> >>> corresponding file in /etc/logrotate.d and adding/changing the
> >>> rotate line. You can find more information by running "man logrotate".
> >>>
> >> ? We want daily log files, so setting 'rotate 4' will only give us 4 log
> >> files. Using weeks is no good because a month is not a fixed number of
> >> weeks - 30 and 31 days are not 4 weeks and vice-versa.
> >>
> > If you are using daily instead of weekly, then set rotate to 31 to
> > keep the max number of days a month can have. Then add a monthly
> > cron job to archive the month of logs if you want to keep them. By
> > using 31 as the number of logs to keep, you insure you have at least
> > a months worth of logs. If the month has less the 31 days, you will
> > have 1 or more daily logs from last month left over.
> > 
> I forgot to add that the files will be numbered in reverse order,
> because of the way logrotate rotates files...

This behavior is configurable.  Add the "dateext" option to the profile
for your logs and the extension will be -yyyymmdd instead of .nn .
Handy because the files sort in forward order (except the current one).

> 
> Another way to do it would be to have a postrotate script that
> renames <log>.1 to <log>.date - you can then archive based on date.
> But for the logs to be accurate, you are going to have to change the
> default time when cron.daily is run, or have logrotate run by itself
> with its own cron entry.
> 
> Mikkel
-- 
                Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux