* Re: syslog.dated- changing log period?
1997-12-18 5:00 syslog.dated- changing log period? Andrew Ireland
@ 1997-12-18 5:00 ` Charles M Richmond
1997-12-19 5:00 ` Richard Beebe II
1997-12-18 5:00 ` Mark Hibberts
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Charles M Richmond @ 1997-12-18 5:00 UTC (permalink / raw)
Andrew Ireland wrote:
>
> Hi,
>
> in the /etc/syslog.conf file, entries with the /var/adm/syslog.dated/<log
> file> have new
> log directories and log files created once per day (or when syslogd is
> restarted).
>
> Is there any way to configure syslog to create a log directory which will
> log files
> and create new directories say once per month?
>
There are two lines in the /var/spool/cron/crontabs/root entry that
are pertinent to the syslogd operation.
The following is the line that actually restarts the logging
process. As you can see, I have chosen midnight to start my logs.
If you want to only do this once a month then just change the '*' in
the 3d field to be the day of the month that you wish to start
your logs on.
0 0 * * * kill -1 `/bin/cat /var/run/syslog.pid`
The line below here is the line that controls how often the old
directories get purged. The key to this is the '-ctime' argument
in the 'find' cmd.
40 4 * * * find /var/adm/syslog.dated -depth -type d -ctime +5 -exec rm
-rf {} \;
Charlie
--
***********************************************************************
* Charles Richmond Integrated International Systems Corporation *
* cmr@iisc.com cmr@koibito.iisc.com cmr@shore.net *
* UNIX Internals, I18N, L10N, X, Realtime Imaging, and Custom S/W *
* One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431 *
* (617) 723 7695 (617) 367 3151 FAX (617) 723 6861 *
***********************************************************************
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: syslog.dated- changing log period?
1997-12-18 5:00 ` Charles M Richmond
@ 1997-12-19 5:00 ` Richard Beebe II
0 siblings, 0 replies; 6+ messages in thread
From: Richard Beebe II @ 1997-12-19 5:00 UTC (permalink / raw)
On Thu, 18 Dec 1997 10:23:19 -0500, Charles M Richmond wrote:
>Andrew Ireland wrote:
>> in the /etc/syslog.conf file, entries with the /var/adm/syslog.dated/<log
>> file> have new
>> log directories and log files created once per day (or when syslogd is
>> restarted).
>>
>> Is there any way to configure syslog to create a log directory which will
>> log files
>> and create new directories say once per month?
>
>There are two lines in the /var/spool/cron/crontabs/root entry that
>are pertinent to the syslogd operation.
>
>The following is the line that actually restarts the logging
>process. As you can see, I have chosen midnight to start my logs.
>If you want to only do this once a month then just change the '*' in
>the 3d field to be the day of the month that you wish to start
>your logs on.
>
>0 0 * * * kill -1 `/bin/cat /var/run/syslog.pid`
There must be more to it than that. I don't have any such line in any crontab
and my syslog restarts every 24-hours from the time of last reboot. I can see
that the above could force it to restart at midnight (though there'd be a
'short' log whenever I rebooted), but I don't see how one could get a syslog
directory that lasted a month.
_____________________________________________________________________
Rick Beebe (203) 785-4566
Network Engineering Manager FAX: (203) 737-4037
ITS-Med Technology Operations Richard.Beebe@yale.edu
Yale University School of Medicine
333 Cedar Street, New Haven, CT 06510
_____________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: syslog.dated- changing log period?
1997-12-18 5:00 syslog.dated- changing log period? Andrew Ireland
1997-12-18 5:00 ` Charles M Richmond
@ 1997-12-18 5:00 ` Mark Hibberts
1997-12-18 5:00 ` Charles M Richmond
1997-12-19 5:00 ` Andrew Ireland
3 siblings, 0 replies; 6+ messages in thread
From: Mark Hibberts @ 1997-12-18 5:00 UTC (permalink / raw)
The following default line in roots crontab is what restarts your logs
30 4 * * * /sbin/kill -HUP `cat /var/run/syslog.pid`
just change the crontab entry to reflect the frequency you wish.
--
Mark Hibberts
Novartis Crop Protection, Greensboro NC
mark.hibberts@cp.novartis.com
------------ All Comments are my own ------------
Andrew Ireland <andy@ascada.demon.co.uk> wrote in article
<882447391.7821.0.nnrp-03.9e982017@news.demon.co.uk>...
> Hi,
>
> in the /etc/syslog.conf file, entries with the /var/adm/syslog.dated/<log
> file> have new
> log directories and log files created once per day (or when syslogd is
> restarted).
>
> Is there any way to configure syslog to create a log directory which will
> log files
> and create new directories say once per month?
>
> Thanks,
>
>
> Andrew Ireland
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: syslog.dated- changing log period?
1997-12-18 5:00 syslog.dated- changing log period? Andrew Ireland
1997-12-18 5:00 ` Charles M Richmond
1997-12-18 5:00 ` Mark Hibberts
@ 1997-12-18 5:00 ` Charles M Richmond
1997-12-19 5:00 ` Andrew Ireland
3 siblings, 0 replies; 6+ messages in thread
From: Charles M Richmond @ 1997-12-18 5:00 UTC (permalink / raw)
Andrew Ireland wrote:
>
> Hi,
>
> in the /etc/syslog.conf file, entries with the /var/adm/syslog.dated/<log
> file> have new
> log directories and log files created once per day (or when syslogd is
> restarted).
>
> Is there any way to configure syslog to create a log directory which will
> log files
> and create new directories say once per month?
>
There are two lines in the /var/spool/cron/crontabs/root entry that
are pertinent to the syslogd operation.
The following is the line that actually restarts the logging
process. As you can see, I have chosen midnight to start my logs.
If you want to only do this once a month then just change the '*' in
the 3d field to be the day of the month that you wish to start
your logs on.
0 0 * * * kill -1 `/bin/cat /var/run/syslog.pid`
The line below here is the line that controls how often the old
directories get purged. The key to this is the '-ctime' argument
in the 'find' cmd.
40 4 * * * find /var/adm/syslog.dated -depth -type d -ctime +5 -exec rm
-rf {} \;
Charlie
--
***********************************************************************
* Charles Richmond Integrated International Systems Corporation *
* cmr@iisc.com cmr@koibito.iisc.com cmr@shore.net *
* UNIX Internals, I18N, L10N, X, Realtime Imaging, and Custom S/W *
* One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431 *
* (617) 723 7695 (617) 367 3151 FAX (617) 723 6861 *
***********************************************************************
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: syslog.dated- changing log period?
1997-12-18 5:00 syslog.dated- changing log period? Andrew Ireland
` (2 preceding siblings ...)
1997-12-18 5:00 ` Charles M Richmond
@ 1997-12-19 5:00 ` Andrew Ireland
3 siblings, 0 replies; 6+ messages in thread
From: Andrew Ireland @ 1997-12-19 5:00 UTC (permalink / raw)
Andrew Ireland wrote in message
<882447391.7821.0.nnrp-03.9e982017@news.demon.co.uk>...
>Is there any way to configure syslog to create a log directory which will
>log files
>and create new directories say once per month?
Thanks to all who replied, here I am answering my own question.
#!/bin/ksh
month=`date +"%b"`
echo "local1.info /var/adm/syslog/log.$month" >
/etc/syslog.conf.monthly
#
# in /etc we have a copy of the original daily log, called syslog.conf.daily
# cat the daily and the monthly file together to /etc/syslog.conf
#
cat /etc/syslog.conf.daily /etc/syslog.conf.monthly > /etc/syslog.conf
#
# it doesn't matter if we overwrite the old syslog.conf file as the syslogd
# will have a note of all the file descriptors
#
If this is run in the root cron script at the beginning of the month
_before_ the
daily restart then when the syslog restarts on the new month it will create
the new files.
^ permalink raw reply [flat|nested] 6+ messages in thread