1833776 Members
2343 Online
110063 Solutions
New Discussion

trimming syslogs

 
SOLVED
Go to solution
frederick hannah
Super Advisor

trimming syslogs

I have mail.log and syslog.log with data going back to 2002. What is the safest way of trimming these logs without impacting my system?
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: trimming syslogs

Use SAM - under routine tasks, there's a log trimming facility that will trim them down to a specified size.


Pete

Pete
Bharat Katkar
Honored Contributor

Re: trimming syslogs

Hi,
Another command line option ...

# > /var/adm/syslog/syslog.log
# > /var/adm/syslog/mail.log

This will empty the file completely.

If you want to trimm the file percentage wise SAM is an better option.

Regards,
You need to know a lot to actually know how little you know
Rita C Workman
Honored Contributor

Re: trimming syslogs

...or if you just want the last xxx number of lines..you could:

tail -500 /var/adm/syslog/syslog.log > /var/adm/syslog/syslog.tmp
mv /var/adm/syslog/syslog.tmp /var/adm/syslog/syslog.log

Simple tail out and move back....but the 'Safest' is what Pete first mentioned...use SAM.

Rgrds,
Rita
Shaikh Imran
Honored Contributor

Re: trimming syslogs

Hi,

If you want you can save the file with a different name before emptying it.

Regards,

I'll sleep when i am dead.
frederick hannah
Super Advisor

Re: trimming syslogs

It seems SAM is the best way to go. Thanks for the quick response.