Friday, June 6, 2008

MacOSX syslog & asl.db system slowdown

I noticed that if Firefox goes apeshit it chew up memory and log repeated errors to syslog that would cause the system to compete for disk I/O.

Aside from Firefox just being crap and loosing it, I found that I could prevent syslog from logging too much crap by reducing the logging level from NOTICE (5) to ERROR (3) - see man 1 syslog for other levels. These changes were inspired by a CodeSnippets post, though the instructions there appear to be far too complex than is needed.

Here's how to do it:

sudo /usr/libexec/PlistBuddy -c "Delete :ProgramArguments" /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments array" /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments:0 string '/usr/sbin/syslogd'" /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments:1 string '-c'" /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments:2 integer 3" /System/Library/LaunchDaemons/com.apple.syslogd.plist


Then you just need to restart syslog:
sudo launchctl stop com.apple.syslogd
sudo launchctl start com.apple.syslogd

No comments: