1832854 Members
3194 Online
110047 Solutions
New Discussion

syslog

 
SOLVED
Go to solution
Daniel Fourie
Frequent Advisor

syslog

How can I limit the size of syslog.log in /var/adm/syslog/

Please Help
Knowlage is Power
6 REPLIES 6
steven Burgess_2
Honored Contributor
Solution

Re: syslog

Hi

Purge and compress it on a daily basis

/sbin/init.d/syslogd stop

mv /var/adm/syslog/syslog.log /var/adm/syslog/syslog.`date`

gzip /var/adm/syslog/syslog.`date`

find /var/adm/syslog ! -newer /var/adm/syslog/syslog.`date` -exec rm {}\;

Then restart which will create a new file

/sbin/init.d/syslogd start

HTH

Steve





take your time and think things through
Rita C Workman
Honored Contributor

Re: syslog

I periodically clean up syslog using the SAM utility for this.

But till I get around to doing this...I recommend just writing a quick script to clean out any verbose and just informational type statements. And/or maybe a script that looks for important/critical things and sends you a page (or email) for the message...then puts the message in a special file and removes it from syslog. So far these have worked for me to keep syslog from growing too fast.

Just a thought,
Rita
Ravi_8
Honored Contributor

Re: syslog

Hi,

I prefer putting Steven's script in crontab file, saving only last weeks syslog files
never give up
Jon Finley
Honored Contributor

Re: syslog

I like the script.

But, after running gzip won't it have a 'gz' extension?

i.e.

syslog.`date`.gz ??

Jon
"Do or do not. There is no try!" - Yoda
Steven E. Protter
Exalted Contributor

Re: syslog

Once a week the following things happen on my system.

cp /var/adm/syslog/syslog.log /tmp/syslog.log.$DATEVAR

> /var/adm/syslog/syslog.log

Zeros the little guy out.

Keeps a copy. DATEVAR has yyyymmdd in it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rory R Hammond
Trusted Contributor

Re: syslog

I keep several week of syslog.
Like Steve P using a cron job

I copy the sys log file

and then Compress the Copy
to save space

echo "" > /var/adm/syslog/syslog.log

zero out the file keep you from haveing to stop and start
cron.

If you don't care about lots of history.
I would use via cron.
/sbin/init.d/syslog stop;
/sbin/init.d/syslog start;
This process would give you a OLDsyslog.log as if you rebooted.

Rory


There are a 100 ways to do things and 97 of them are right