[TriLUG] Question about logs
Jon Carnes
jonc at nc.rr.com
Wed Jun 25 23:13:22 EDT 2003
On Wed, 2003-06-25 at 19:28, Jaimie.Livingston at haht.com wrote:
> If I wanted to have log rotation for a generic service controlled by an
> individual logrotate.d script, but that service doesn't already have it's
> own logrotate script (and doesn't have one installed by rpm), can I create a
> control script for it by just creating a script called servicename with the
> options I want and drop that file into /etc/logrotate.d?
>
Yes. I do this all the time. Use the existing files to build the config
for the file you want - they are good examples. If there is something
special you don't find in one of them, check out the man pages.
One caveat: name your log files <filename>.log so that you can easily
rotate them (ie. *.log). Otherwise you might be tempted to use a
wildcard that would accidently catch rotated log files as well - and
then your log files grow geometrically every day.
> Also, I'd like to set a size limit on my /var/log/maillog* files, but am not
> quite sure if I can, since there are references to the maillog files already
> in /etc/logrotate.d/syslog. Can the maillog be controlled separately from
> the configuration in /etc/logrotate.d/syslog?
Delete the /var/log/maillog entry out of the syslog rotation before you
create a different entry for handling the mail.
Look at the "size" parameter.
size=<size>
Log files are rotated when they grow bigger then <size> bytes. If
<size> is followed by M, the size if assumed to be in megabytes.
If the k is used, the size is in kilobytes. So size=100, size=
100k, and size=100M are all valid.
You would put something like "size=10M" in place of the "weekly" or
"daily" parameter you are used to seeing in logrotate config files.
Hope that helps - Jon
More information about the TriLUG
mailing list