How to access Console Device log in macOS via terminal

macOS has Console app to view different logging activities. Console has a group Devices in the top left corner with the mac itself and connected devices such as iPhone. I would like to access mac device log via terminal. I need it to check logs of remote mac server without TeamViewer and any GUI interactions to do it faster using ssh. Is it possible?


log collect has --device/--device-name options.

--device Collect system logs from paired device (first device found).
--device-name name Collect system logs from paired device with the given name.
--device-udid UDID Collect system logs from paired device with the given UDID.

  1. Collect some logs

    log collect --device-name foo
    
  2. wait, then ⌃C

  3. Show the logs collected

    log show --archive system_logs.logarchive