1753784 Members
7243 Online
108799 Solutions
New Discussion юеВ

Re: syslog for 60 days

 
SOLVED
Go to solution
Ravi_8
Honored Contributor

Re: syslog for 60 days

Hi, Leif and rajeev

commented that line in syslogd file under /sbin/init.d and made a crontab entry.
but after reboot syslogd daemon is not starting
never give up
Marco Santerre
Honored Contributor

Re: syslog for 60 days

I would probably go the cron route myself. But the one thing to keep in mind is to shut down the syslogd daemon first before you move your files around. The reason for this is that the syslogd will create the syslog.log file on its own and attach itself to it, so if you copy the syslog.log without stopping the daemon first, the daemon will be all screwed trying to write to your OLDsyslog.log after you've copied it. Now the bad part about this, is for the time you will stop your daemon, you won't record anything into your syslog.
Cooperation is doing with a smile what you have to do anyhow.
Rajeev  Shukla
Honored Contributor
Solution

Re: syslog for 60 days

Ravi There is no need of commenting the line in /sbin/init.d/syslogd
and neither do move the file /var/adm/syslog/syslog.log. always copy this file to /var/adm/syslog/syslog.log.DATE through a some script called by cron and then trim the syslog.log to zero by just doing > syslog.log.

With this method you have syslog of each day saved and you dont need to bring down the syslogd demon also.

Cheers
Rajeev
Leif Halvarsson_2
Honored Contributor

Re: syslog for 60 days

Hi,
Sorry, you actually has to comment out all the following lines.

if [ -f /var/adm/syslog/syslog.log ]; then
# mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.log
# mask=`umask`
# umask 022
# > /var/adm/syslog/syslog.log
# umask $mask
# fi

I tested this on one of our systems, the syslogd starts after rebooting and the boot messages are appended to the syslog.log file (no new file is created).
Leif Halvarsson_2
Honored Contributor

Re: syslog for 60 days

Sorry again,
I have problems with cut and paste. The line

if [ -f /var/adm/syslog/syslog.log ]; then

should of course be commented out too.
Ravi_8
Honored Contributor

Re: syslog for 60 days

Hi,
by adding few lines in syslogd file solved my problem. here is the portion of this file which i modified

start')
if [ -x /usr/sbin/syslogd -a -f /etc/syslog.conf ]; then
if[ -f /var/adm/syslog/OLDsyslog.log]
then
cat /var/adm/syslog/OLDsyslog.log >> /var/adm/syslog/syslog
then
if [ -f /var/adm/syslog/syslog.log ]; then
mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.log
mask=`umask`
umask 022
>/var/adm/syslog/syslog.log
umask $mask

Rajeev and Leif thanx a lot
never give up
Q4you
Regular Advisor

Re: syslog for 60 days

If you are still looking for a solution to preserve the syslog file aftr every reboot , add this rotation login in syslogd ->
if [ -x /usr/sbin/syslogd -a -f /etc/syslog.conf ]; then
if [ -f /var/adm/syslog/OLD5syslog.log ]; then
mv /var/adm/syslog/OLD5syslog.log /var/adm/syslog/OLD6syslog.log
fi
if [ -f /var/adm/syslog/OLD4syslog.log ]; then
mv /var/adm/syslog/OLD4syslog.log /var/adm/syslog/OLD5syslog.log
fi
if [ -f /var/adm/syslog/OLD3syslog.log ]; then
mv /var/adm/syslog/OLD3syslog.log /var/adm/syslog/OLD4syslog.log
fi
if [ -f /var/adm/syslog/OLD2syslog.log ]; then
mv /var/adm/syslog/OLD2syslog.log /var/adm/syslog/OLD3syslog.log
fi
if [ -f /var/adm/syslog/OLD1syslog.log ]; then
mv /var/adm/syslog/OLD1syslog.log /var/adm/syslog/OLD2syslog.log
fi
if [ -f /var/adm/syslog/syslog.log ]; then
mv /var/adm/syslog/syslog.log /var/adm/syslog/OLD1syslog.log

Q4you
Regular Advisor

Re: syslog for 60 days

If you are still looking for a solution to preserve the syslog file after every reboot(upto 6 reboots) , add this rotation logic in syslogd ->

if [ -x /usr/sbin/syslogd -a -f /etc/syslog.conf ]; then
if [ -f /var/adm/syslog/OLD5syslog.log ]; then
mv /var/adm/syslog/OLD5syslog.log /var/adm/syslog/OLD6syslog.log
fi
if [ -f /var/adm/syslog/OLD4syslog.log ]; then
mv /var/adm/syslog/OLD4syslog.log /var/adm/syslog/OLD5syslog.log
fi
if [ -f /var/adm/syslog/OLD3syslog.log ]; then
mv /var/adm/syslog/OLD3syslog.log /var/adm/syslog/OLD4syslog.log
fi
if [ -f /var/adm/syslog/OLD2syslog.log ]; then
mv /var/adm/syslog/OLD2syslog.log /var/adm/syslog/OLD3syslog.log
fi
if [ -f /var/adm/syslog/OLD1syslog.log ]; then
mv /var/adm/syslog/OLD1syslog.log /var/adm/syslog/OLD2syslog.log
fi
if [ -f /var/adm/syslog/syslog.log ]; then
mv /var/adm/syslog/syslog.log /var/adm/syslog/OLD1syslog.log