How do I decode the contents of Apple System Logs in /var/log/DiagnosticMessages (using the command line)
Reading from a GUI
For anything that's system related you can typically use the Console application to view their contents. Here I've launched the application and navigated to the /var/log/DiagnosticMessages
directory and then selected one of the ASL files, 2019.03.11.asl
:
If you're in a terminal you can launch Console directly like so:
$ open -a console
Reading files from the CLI
If you'd rather read these files from the terminal, you can use either the Python library, asl
and write your application to process them or you can use the syslog
CLI tool to read them.
For example:
$ syslog -f /var/log/DiagnosticMessages/2019.03.11.asl | head -20
NOTE: Most system logs have moved to a new logging system. See log(1) for more information.
Mar 11 00:01:10 unagi Finder[564] <Notice>:
Mar 11 00:01:40 unagi Google Chrome[7050] <Debug>:
--- last message repeated 1 time ---
Mar 11 00:06:42 unagi corebrightnessd[109] <Notice>:
--- last message repeated 1 time ---
Mar 11 00:06:45 unagi ControlStrip[506] <Notice>:
--- last message repeated 4 times ---
Mar 11 00:16:14 unagi Google Chrome[7050] <Debug>:
Mar 11 00:16:18 unagi ControlStrip[506] <Notice>:
--- last message repeated 2 times ---
Mar 11 00:17:27 unagi corebrightnessd[109] <Notice>:
--- last message repeated 1 time ---
Mar 11 00:17:34 unagi ControlStrip[506] <Notice>:
--- last message repeated 5 times ---
Mar 11 00:24:06 unagi esets_daemon[280] <Notice>:
--- last message repeated 6 times ---
Mar 11 00:24:18 unagi ControlStrip[506] <Notice>:
--- last message repeated 1 time ---
Mar 11 00:26:35 unagi corebrightnessd[109] <Notice>:
--- last message repeated 2 times ---
References
- How to View the System Log on a Mac
- Retrieving Console logs on Mac
- Reading ASL log file - Python