Syslog on Mac OS X: Cheat Sheet
This is a quick cheatsheet to work with syslog(1)
implementation OS X uses.
Console.app
provides a nice UI to access logs in mac, you can do some basic filtering and search, but its limited in terms of raw control a terminal gives you.
/usr/bin/syslog
can be used to both send and receive logs. Alternatively logger(1)
can be used to send logs to syslog.
Print logs from a specific facilitiy
# -w: similar to tailf
syslog -k Facility local1 -w
Sending logs
# -l severity level
syslog -s "message"
Sending logs upstream to another syslog server
Syslog can forward your logs too. The configuration resides in /etc/syslog.conf
. You can append forwarding rules in this file, format is
# Tab separated
Facility.Level @IPADDR:PORT
After this reload syslog daemon.
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plistp
Extra reading
asl.conf(5)
- Configuration file for Apple Syslog Log (A syslog superset apple implements), this is where all the logic to route logs are set facility.level