Skip to content

Instantly share code, notes, and snippets.

@inouetmhr
Last active December 2, 2018 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inouetmhr/87b5e3aa91c4d373c4e6 to your computer and use it in GitHub Desktop.
Save inouetmhr/87b5e3aa91c4d373c4e6 to your computer and use it in GitHub Desktop.
Mac OSXのsyslogでリモートからのログを別ファイルに保存する

外部からのログ転送を受け付けるように設定

sudo defaults write /System/Library/LaunchDaemons/com.apple.syslogd.plist Sockets -dict-add NetworkListener "{ SockServiceName = syslog; SockType = dgram; }"

特定のログを別ファイルに書いてローテートするように設定

/etc/asl/remote-syslog (新規作成):

? [= Facility user] [! Host <FQDN of localhost>] claim only
* file /var/log/remote-syslog.log mode=0644 rotate=seq compress file_max=1M all_max=50M 

syslogd再起動

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment