[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Rottlog-develop] Re: Just an idea I had
From: |
Frederic Connes |
Subject: |
[Rottlog-develop] Re: Just an idea I had |
Date: |
Tue, 17 Sep 2002 11:44:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1b) Gecko/20020731 |
Hi Stefano,
I think I will add "custom" config file and improve much more forceday
parameter. Probably I will rename it to "period" and let to handle somethink
like:
(following your ideas)
period n -> Each n day
period Dd -> Each Dth day of the month
period <weekday> -> Each <weekday> of the week
period 0 -> Each time rottlog is called (*)
period HHh -> Each HH hour (*)
period MMm -> Each MM minutes (*)
(*) It depends on rottlog's entries in crontab
What do you think about it?
Well, I think this would be great !
I thought about a way to generalise the rotation format.
Here's where I came to:
Basically, there are two ways to rotate the files:
- on a regular basis (every 2 days, every week...)
- on a specific date (each sunday, each 15th of the month...)
So maybe it's worth being explicit about it and use two variables:
- period
- date
The syntax of period would be:
period <x> <period>
<period> could be:
- m (minutes)
- h (hours)
- d (days)
- w (weeks)
- M (months)
If <period> is missing, assume it is d (or let it be configured in rc)
If <x> is 0, rotate each time rottlog is called
(so 0, 0d, 0h are the same)
The syntax of date would be:
date <date>
<date> could be:
- a weekday, abbreviated or not (sun or sunday)
- a monthday, abbreviated or not (sep or september)
- a day of month (1 to 31): a number
- a time (hh:mm): two numbers separated with a ":"
I think the time is useful if for example one works in a company that
has a busy internal web site and wants to rotate the web logs at 13:00
when people are at lunch (but not the other logs, so cron would be
useless here).
What would be great would be to be able to AND and OR the dates, so one
could say:
date mon,tue,wed,thu,fri 13:00,20:00
date sat 20:00
(this would then allow some very powerful enhancements like mon-fri or a
NOT operator)
Now, about the files:
Rottlog uses 3 files, which correspond to the most current rotation
periods. I think it is possible to extend this to something fully
customizable.
Let use the period and date syntax to define when a configuration file
must be read. Now you can define the daily, weekly and monthly files as
specific cases, but you can also define any other file that fits your needs.
For example, you could define the following files:
weekly {
period 1w
}
daily {
period 1d
date 04:00
}
if you call rottlog with cron every hour for some reason but want to
rotate the files defined in daily at 04:00.
apache {
date mon,tue,wed,thu,fri 13:00,20:00
date sat 20:00
}
if for instance you have many virtual hosts and want to group your
apache log files
bycron {
period 0
}
if you want to group the files to rotate each time rottlog is called.
anotherfile {
custom
}
custom would mean: in this file, look at the date and period in each
logfile entry (this is for people having so specific needs that they
would need to define one file per logfile entry: with custom, they could
have only one file if they want, as in RedHat logrotate).
Now rottlog wouldn't make any asumption about the way the user wants to
rotate the files, and it would allow him to define as many configuration
files as he needs to organize the rotations, from one (with custom) to
infinite.
Maybe the following definitions could be put in rc, and the following
lines be added by default:
daily {
period 1d
}
weekly {
period 1w
}
monthly {
period 1M
}
custom {
custom
}
I think this way it would be possible to organize the rotation as in the
current rottlog or as in logrotate or as the user wants to.
What do you think about it ?