System Log

From The iPhone Wiki
Revision as of 09:57, 31 August 2008 by MiW (talk | contribs) (ooooopps! do we need to be worried about user posting Hashes? Apple has a record of these via our ITMS's)
Jump to: navigation, search

2 Syslogs?!?

MiWs-IPhone:/var/log root# locate syslogd
/private/var/stash/libexec.??????/syslogd
/System/Library/LaunchDaemons/com.apple.syslogd.plist
/usr/sbin/syslogd
Miws-IPhone:/var/log root# ls -al /private/var/stash/libexec.??????/syslogd
-rwxr-xr-x 1 root wheel 216240 Jun 15 07:13 /private/var/stash/libexec.??????/syslogd*
Miws-IPhone:/var/log root# ls -al /usr/sbin/syslogd
-r-xr-xr-x 1 root wheel 72096 Aug 10 19:38 /usr/sbin/syslogd*

Thats a little strange.

MiW-IPhone:~ root# /var/stash/libexec.??????/syslogd --version
syslogd (GNU inetutils) 1.5
MiW-IPhone:~ root# /usr/libexec/syslogd --version
syslogd (GNU inetutils) 1.5

Same version, 71K vs 212K.... What is the difference friends?


bgm's trick for enabling system log

1. In the shell, do: echo "*.* /var/log/syslog" > /etc/syslog.conf

2. Add the following tags to /System/Library/LaunchDaemons/com.apple.syslogd.plist after the tag <string>/usr/sbin/syslogd</string>

<string>-bsd_out</string>
<string>1</string>

This will tell the Daemon Launcher to call /usr/sbin/syslogd -bsd_out 1, and we have configured it to write all messages to /var/log/syslog

3. "reboot & enjoy your kernel and other messages" (bgm)

Note

The syslog will grow very big quite quickly, but the folder /var/log/syslog is on the data partition (music, etc).
If you keep your device full of music, be careful you don't fill the partition. Unix systems tend to break when they cant write to the syslog. Keep an eye on it or employ some log rotation.

To disable: In a shell, do:

rm /var/log/syslog; mknod /var/log/syslog c 3 2

This will turn /var/log/syslog into a /dev/null

To reenable: In a shell, do:

rm /var/log/syslog; touch /var/log/syslog

This will remove the /dev/null and make a blank regular file


Reference

http://code.google.com/p/iphone-elite/wiki/IphoneSyslogd
(full history: http://code.google.com/p/iphone-elite/source/list?path=/wiki/IphoneSyslogd.wiki&start=398)