blogng/blog/2015-02-21-syslog-on-mac-os-x-cheat-sheet.markdown
Dhananjay Balan 3a30fb8a07 Compatibility with Octopress site.
Don't break urls.
 1. New Route function which generates routes compatible with old blog.
 2. Renamed posts folder to blog.
2017-01-31 20:44:01 +01:00

1.6 KiB

layout title date comments categories
post Syslog on Mac OS X: Cheat Sheet 2015-02-21 00:41 true
mac
osx
syslog
cheatsheet

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

  1. 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