How do I decode the contents of Apple System Logs in /var/log/DiagnosticMessages (using the command line) I would like to decode the contents of the files in /var/log/DiagnosticMessages. 

My laptop currently has 52MB of such files:

$ ls -l
total 53572
-rw-r--r--@ 1 root  admin   483660 Mar 11 22:48 2019.03.11.asl
-rw-r--r--@ 1 root  admin   283433 Mar 12 22:19 2019.03.12.asl
-rw-r--r--@ 1 root  admin   385278 Mar 13 23:58 2019.03.13.asl
-rw-r--r--@ 1 root  admin   957492 Mar 14 18:43 2019.03.14.asl
-rw-r--r--@ 1 root  admin   690894 Mar 15 23:39 2019.03.15.asl
-rw-r--r--@ 1 root  admin   731637 Mar 16 16:52 2019.03.16.asl
-rw-r--r--@ 1 root  admin   146741 Mar 17 23:59 2019.03.17.asl
-rw-r--r--@ 1 root  admin  1683982 Mar 18 18:04 2019.03.18.asl
-rw-r--r--@ 1 root  admin  2247577 Mar 19 20:00 2019.03.19.asl
-rw-r--r--@ 1 root  admin  1608485 Mar 20 23:03 2019.03.20.asl
-rw-r--r--@ 1 root  admin   429023 Mar 21 23:50 2019.03.21.asl
-rw-r--r--@ 1 root  admin   599787 Mar 22 23:50 2019.03.22.asl
-rw-r--r--@ 1 root  admin  1368664 Mar 23 23:59 2019.03.23.asl
-rw-r--r--@ 1 root  admin  2098076 Mar 24 20:46 2019.03.24.asl
-rw-r--r--@ 1 root  admin   595091 Mar 25 23:59 2019.03.25.asl
-rw-r--r--@ 1 root  admin   201277 Mar 26 22:00 2019.03.26.asl
-rw-r--r--@ 1 root  admin  1409147 Mar 27 23:02 2019.03.27.asl
-rw-r--r--@ 1 root  admin  1091149 Mar 28 22:55 2019.03.28.asl
-rw-r--r--@ 1 root  admin   264362 Mar 29 21:57 2019.03.29.asl
-rw-r--r--@ 1 root  admin  1004813 Mar 30 22:21 2019.03.30.asl
-rw-r--r--@ 1 root  admin  2597856 Mar 31 23:50 2019.03.31.asl
-rw-r--r--@ 1 root  admin  2662448 Apr  2 00:58 2019.04.01.asl
-rw-r--r--@ 1 root  admin  8533505 Apr  3 00:59 2019.04.02.asl
-rw-r--r--@ 1 root  admin  6067003 Apr  4 00:39 2019.04.03.asl
-rw-r--r--@ 1 root  admin  2345193 Apr  5 00:58 2019.04.04.asl
-rw-r--r--@ 1 root  admin  1898596 Apr  6 00:59 2019.04.05.asl
-rw-r--r--@ 1 root  admin  2067999 Apr  7 00:45 2019.04.06.asl
-rw-r--r--@ 1 root  admin  1337325 Apr  7 23:27 2019.04.07.asl
-rw-r--r--@ 1 root  admin   582943 Apr  8 23:58 2019.04.08.asl
-rw-r--r--@ 1 root  admin   484791 Apr  9 18:01 2019.04.09.asl
-rw-r--r--@ 1 root  admin        8 Apr  9 18:01 StoreData



It is unclear how to read them. File shows up as type data.

$ file 2019.03.11.asl
2019.03.11.asl: data


And looking thru its contents you can make out some text but nothing that's very telling:

$ xxd 2019.03.11.asl | head -20
00000000: 4153 4c20 4442 0000 0000 0000 0000 0002  ASL DB..........
00000010: 0000 0000 0000 0304 0000 0000 5c85 df11  ............\...
00000020: 0000 0080 0000 0000 0000 0760 6200 0000  ...........`b...
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0001 0000 000e 6d65 7373 6167 6574 7261  ......messagetra
00000060: 6365 7200 0001 0000 0019 636f 6d2e 6170  cer.......com.ap
00000070: 706c 652e 6d65 7373 6167 652e 646f 6d61  ple.message.doma
00000080: 696e 0000 0100 0000 1f63 6f6d 2e61 7070  in.......com.app
00000090: 6c65 2e70 6f77 6572 642e 7072 6f78 696d  le.powerd.proxim
000000a0: 6974 7957 616b 6500 0001 0000 001d 636f  ityWake.......co
000000b0: 6d2e 6170 706c 652e 6d65 7373 6167 652e  m.apple.message.
000000c0: 5f5f 736f 7572 6365 5f5f 0000 0100 0000  __source__......
000000d0: 2b63 6f6d 2e61 7070 6c65 2e6d 6573 7361  +com.apple.messa
000000e0: 6765 2e64 6172 6b77 616b 6532 6869 6461  ge.darkwake2hida
000000f0: 6374 6976 6974 796f 6e61 6300 0001 0000  ctivityonac.....
00000100: 002d 636f 6d2e 6170 706c 652e 6d65 7373  .-com.apple.mess
00000110: 6167 652e 6461 726b 7761 6b65 3268 6964  age.darkwake2hid
00000120: 6163 7469 7669 7479 6f6e 6261 7474 0000  activityonbatt..
00000130: 0100 0000 096e 6577 6461 6e63 6500 0001  .....newdance...
$ 


EDIT: I do not want to use the Console application. I want to understand either the file format or have a command-line program for extracting the raw data.
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] &lt;Notice&gt;:
Mar 11 00:01:40 unagi Google Chrome[7050] &lt;Debug&gt;:
--- last message repeated 1 time ---
Mar 11 00:06:42 unagi corebrightnessd[109] &lt;Notice&gt;:
--- last message repeated 1 time ---
Mar 11 00:06:45 unagi ControlStrip[506] &lt;Notice&gt;:
--- last message repeated 4 times ---
Mar 11 00:16:14 unagi Google Chrome[7050] &lt;Debug&gt;:
Mar 11 00:16:18 unagi ControlStrip[506] &lt;Notice&gt;:
--- last message repeated 2 times ---
Mar 11 00:17:27 unagi corebrightnessd[109] &lt;Notice&gt;:
--- last message repeated 1 time ---
Mar 11 00:17:34 unagi ControlStrip[506] &lt;Notice&gt;:
--- last message repeated 5 times ---
Mar 11 00:24:06 unagi esets_daemon[280] &lt;Notice&gt;:
--- last message repeated 6 times ---
Mar 11 00:24:18 unagi ControlStrip[506] &lt;Notice&gt;:
--- last message repeated 1 time ---
Mar 11 00:26:35 unagi corebrightnessd[109] &lt;Notice&gt;:
--- 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