Here's one hint that I use to keep my mail logs under control. The way the periodic commands are set up, the mail logs are only rotated on a weekly basis. In my case, that resulted in extremely _large_ mail logs. Taking a hint from serversolutions at the afp548.com site, I modified my periodic commands.
Open /private/etc/periodic/daily/500.daily in your favorite text editor. Look at line 97.
for i in system.log; do
Modify this line to read:
for i in system.log mail.log; do
Then save the file.
Then open /private/etc/periodic/weekly500.weekly. Line 35 is the one that needs modified, change it from
for i in http://ftp.log lookupd.log lpr.log mail.log netinfo.log hwmond.log ipfw.log ppp.log secure.log; do
to
for i in http://ftp.log lookupd.log lpr.log netinfo.log hwmond.log ipfw.log ppp.log secure.log; do
Now your mail log will be rotated on a daily basis.
I keep meaning to write a shell script to automatically move the oldest mail log to a central archive location, but never get around to it. It could actually be embedded in the 500.daily file to save the oldest log daily.
Jeff, be carefull. if I remember correctly the original cron files might be overwritten by a software update. It's better to copy the original and put the additional jobs there.
Don't have any evidence to support this at the moment. Will dig deeper...
jstubbs 25 Sep 2006
richard5 Escribió:
Jeff, be carefull. if I remember correctly the original cron files might be overwritten by a software update. It's better to copy the original and put the additional jobs there.
Don't have any evidence to support this at the moment. Will dig deeper...
I agree, modifying any Apple supplied process is a known risk. This hint has worked for me from Jaguar (10.2) on, and has survived the minor updates along the way.
With Tiger, I was worried about cron moving under launchd's control, but it seems to not have been affected.
I guess you could create another cron process, that would only run Monday to Saturday, to rotate the mail log. Then the weekly periodic script would rotate the log on Sundays.
25 Sep 2006
Open /private/etc/periodic/daily/500.daily in your favorite text editor. Look at line 97.
for i in system.log; doModify this line to read:
for i in system.log mail.log; doThen save the file.
Then open /private/etc/periodic/weekly500.weekly. Line 35 is the one that needs modified, change it from
tofor i in http://ftp.log lookupd.log lpr.log mail.log netinfo.log hwmond.log ipfw.log ppp.log secure.log; dofor i in http://ftp.log lookupd.log lpr.log netinfo.log hwmond.log ipfw.log ppp.log secure.log; doNow your mail log will be rotated on a daily basis.
I keep meaning to write a shell script to automatically move the oldest mail log to a central archive location, but never get around to it. It could actually be embedded in the 500.daily file to save the oldest log daily.
25 Sep 2006
Don't have any evidence to support this at the moment. Will dig deeper...
25 Sep 2006
richard5 Escribió:
I agree, modifying any Apple supplied process is a known risk. This hint has worked for me from Jaguar (10.2) on, and has survived the minor updates along the way.
With Tiger, I was worried about cron moving under launchd's control, but it seems to not have been affected.
I guess you could create another cron process, that would only run Monday to Saturday, to rotate the mail log. Then the weekly periodic script would rotate the log on Sundays.