1833059 Members
2684 Online
110049 Solutions
New Discussion

Cleaning system log

 
vicky_10_1
Occasional Contributor

Cleaning system log

Hi,

My system's /var/adm/syslog/mail.log file was large, I cleared the file with : >mail.log

Is this the correct way of clearing system log files ? Do I need to stop the mail daemon before clearing the logs.
3 REPLIES 3
Oviwan
Honored Contributor

Re: Cleaning system log

Fat Scrape
Honored Contributor

Re: Cleaning system log

Hi Vicky,

if you decide to clear mail.log remember that this file is locked by syslogd and not by sendmail.

If you check /etc/syslog.conf file you see that mail.log is managed by syslogd.

This test in my machine:

fuser /var/adm/syslog/mail.log
/var/adm/syslog/mail.log: 584o

ps -ef |grep 584
root 584 1 0 Dec 5 ? 0:10 /usr/sbin/syslogd -D

This means that /var/adm/syslog/mail.log is in open state by syslogd daemon.

Following this step to clear mail.log:
cd /var/adm/syslog
/sbin/init.d/syslogd stop
mv mail.log mail.log.old
touch mail.log
/sbin/init.d/syslogd start

If you want to do every time mail.log grow bigger then bytes you can use logrotate utility.

Regards,

Fat



NMory
Respected Contributor

Re: Cleaning system log

Vicky:

You could also use SAM if it's easier for you.
Just go to Routine Tasks, then System Lof Files, and should be able to select the logs that you would like to clear.
Then go to Actions--Trim.

That should take care of that.

Regards,

NM