Install a syslog server on macOS (lab use)
When to use this: You only have a Mac and want to receive syslog for a demo or learning.
Before you start
Steps
-
Install syslog-ng
terminalbrew install syslog-ngInstalls the open-source edition.
-
Write a minimal receiver config
terminalmkdir -p /opt/homebrew/var/log/remote cat > /opt/homebrew/etc/syslog-ng.conf <<'EOF' @version: current source s_net { network(transport("udp") port(5514)); network(transport("tcp") port(5514)); }; destination d_remote { file("/opt/homebrew/var/log/remote/${SOURCE_IP}/${YEAR}-${MONTH}-${DAY}.log" create-dirs(yes)); }; log { source(s_net); destination(d_remote); }; EOFReceives UDP and TCP on 5514 and writes one folder per sender IP. On Intel Macs replace
/opt/homebrewwith/usr/local. Replace@version: currentwith the exact version yoursyslog-ng --versionprints if it complains. -
Check the config and start it
terminalsyslog-ng --syntax-only brew services start syslog-ngSyntax check first, then run it as a background service.
-
Allow incoming connections
When macOS asks whether
syslog-ngmay accept incoming connections, click Allow, or add it under System Settings, Network, Firewall. -
Keep the Mac awake while collecting
terminalcaffeinate -sPrevents sleep while the command runs (leave the terminal open). Sleeping Macs drop all logs.
How to verify it worked
- Send a test from another machine and see the file appear under the remote log folder.
How to undo it
Stop the service:
brew services stop syslog-ngCommon errors and fixes
Permission denied binding to port 514 Use a port above 1024 such as 5514, or run with sudo (not recommended for a long-running service). Q&A
Why not just use the Mac's built-in logging?
Apple's unified logging (log command) is for the Mac's own logs. It does not collect syslog from other devices.
Better alternative on a Mac?
Run an Ubuntu VM (UTM, VMware Fusion or Docker) with rsyslog. It matches production and survives sleep better if hosted elsewhere.