Logging - macadmins/nudge GitHub Wiki

Streaming

Nudge uses os_log for all logging, this streams logs to then built in logging system.

You can view the default Nudge logs in Terminal using

log stream --predicate 'subsystem == "com.github.macadmins.Nudge"' --style syslog --color none

Adding the --info option will give you more detailed information about what Nudge is doing and --debug will give you even more.

log stream --predicate 'subsystem == "com.github.macadmins.Nudge"' --info --style syslog --color none

Using the --level flag you can set the displayed logs to debug, info, warning, or error.

Or make them more parsable using the json flag

log show --predicate 'subsystem == "com.github.macadmins.Nudge"' --info --style json --debug

Streaming with JQ

You could alternatively do something like this to only return the output of the events

log stream --predicate 'subsystem == "com.github.macadmins.Nudge"' --style ndjson --color none | egrep --line-buffered '^{' | jq '. | .eventMessage'

The output would then look like

"Device pastRequiredInstallationDate: false"
"allowedDeferralsUntilForcedSecondaryQuitButton has been passed"
"allowedDeferrals has been passed"
"Synthetically clicked updateDevice due to allowedDeferral count"

Thanks to Dre for this tip.

Archiving

There is the option of using sudo log collect to collect all of the system logs into a .logarchive and then review it using the --source flag in log show

Storing in a log file

Because these logs are only streaming they're not stored for very long (depending on the level). If you want non-ephemeral logs then you should setup a Launch Daemon that streams the logs into a file

An example LaunchDaemon can be found here. Upon loading the daemon, it will start writing the logs to /var/log/Nudge.log which you can either tail or open with the Console app.

This LaunchDaemon is also offered as an optional signed package for installation.