Syslogd configuration and remote logging

I am trying to configure the syslogd daemon to accept remote logs. I want to have my Airport logs sent to my main machine on the network. Unfortunately, the only Support doc in this (Article ID: 107993) is written for pre-Tiger OS X machines. The issue is that previous to Tiger, you edited /etc/rc to manipulate syslogd's parameters. With Tiger, syslogd isn't launched from /etc/rc any more and I have no idea how to configure it. Any ideas out there?

Posted on Aug 4, 2005 7:11 PM

Reply
6 replies

Aug 19, 2005 10:03 AM in response to Ian Glazer

[ Edited by Apple Discussions Moderator; this information is from Configuring Tiger's syslogd to accept logs from external devices. Please quote your sources ]

Starting with Tiger, syslogd is initiated upon system startup by launchd, a new Apple daemon that manages the instantiation of other daemons and processes. System daemons are launched with the aid of a plist, an XML text file, placed in /System/Library/LaunchDaemons, and a file in that folder, named com.apple.syslogd.plist, is what we must edit to enable external logging functionality.

It's probably simplest to edit this plist in the Terminal. Backing up this plist file before editing it is a good idea, so start up Terminal and enter this line at the prompt:

sudo cp /System/Library/LaunchDaemons/com.apple.syslogd.plist ~/Desktop/

For those unfamiliar with the Terminal, this command copies the plist file to the desktop for temporary safekeeping. The command to restore the file back to its original state is inversely thus:

sudo cp ~/Desktop/com.apple.syslogd.plist /System/Library/LaunchDaemons/

Next, we proceed to edit the plist:

sudo nano /System/Library/LaunchDaemons/com.apple.syslogd.plist

This line starts up the text editor nano as the root user to edit the plist file mentioned above. Scroll down to this line:

<string>/usr/sbin/syslogd</string>

...and add the following directly below it:

<string>-u</string>

Save and exit. The -u we've inserted is a switch at the end of the syslogd command that tells the process to listen on UDP port 514. Now that syslogd is ready to receive logging messages from other devices, we have to stop the current running syslogd process and restart it with the new option to listen.

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist

sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

launchctl is a utility that instructs launchd to load and unload daemons, among other things. To verify that syslogd is receiving logging messages from external devices, we can watch the system log in action with this command:

tail -f /var/log/system.log

The last screenful of the syslog will be displayed. When new events are received by syslogd, they'll be displayed on the screen and written to the log. Control-c will terminate the syslog watch.

That was easy! Well... wait for it... there's a catch. (You knew that, didn't you?) As of 10.4.1, there is a bug of some kind that affects syslogd. Each day in the wee hours of the morning, your Mac runs a script called /etc/periodic/daily/500.daily. Near the end of that script, the syslogd process is killed using the old-fashioned Unix kill command and when it restarts, for whatever reason, syslogd simply ceases to function. Not only does it not pay attention to log messages sent from other devices, it doesn't bother to record logging information from the local machine.

Fortunately, there's a simple fix. Also near the end of 500.daily, there is a command to call up another file named /etc/daily.local. This file is intended to execute additional commands for specific machines on a daily basis. This file may or may not already exist on your Mac. Either way, let's edit (or create) it with the following command in the terminal:

sudo nano /etc/daily.local

The contents of this file are pretty simple.

launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sleep 1
launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

Save and exit. This script stops and restarts the syslogd process via launchd so that it once again will listen for external logging messages. This script differs just a bit from the commands we used at the terminal. Since 500.daily runs as root and calls up daily.local, daily.local also runs as root, so the sudo command is not needed for launchctl. Also, we've inserted a sleep command to give the computer a second

Oct 3, 2005 5:13 PM in response to Byron Peterson1

A quick 'ps ax|grep syslogd' might be a good idea to see if it's running output should look something like:

localhost:/var/log root# ps ax|grep syslogd
12480 ?? Ss 0:01.35 /usr/sbin/syslogd -u
12515 p0 R+ 0:00.00 grep syslogd

If the above is displayed, and you don't just get null data. You might want to try 'netstat -a -n |grep 514' that will show you if you've got UDP 514 open and listening.

If it's working it should look something like:

udp4 0 0 *.514 .
udp46 0 0 *.514 .

If you recieve null data on either of the above you've got a problem in your config.

Oct 3, 2005 5:16 PM in response to J P7

Ok, so here's my issue. I've got the syslogd daemon running with the '-u' flag and I'm experiencing issues after about 13500~ messages being received by my Tiger server. The syslog process just stops logging altogether. My temporary solution has been to toss "/usr/bin/killall syslogd" in an hourly cron job but this is not acceptable for the long term.

Is there a better solution for this, or is OSX the wrong platform for a log server?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Syslogd configuration and remote logging

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.