HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

log — View, export, and configure logging systems. More information: <https://keith.github.io/xcode-man-pa

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandandconfigurelogginglogexportcliview
macos

Problem

How to use the log command: View, export, and configure logging systems. More information: <https://keith.github.io/xcode-man-pages/log.1.html>.

Solution

log — View, export, and configure logging systems. More information: <https://keith.github.io/xcode-man-pages/log.1.html>.

Stream live system logs:
log stream


Stream logs sent to syslog from the process with a specific PID:
log stream --process {{process_id}}


Show logs sent to syslog from a process with a specific name:
log show --predicate "process == '{{process_name}}'"


Export all logs to disk for the past hour:
sudo log collect --last {{1h}} --output {{path/to/file.logarchive}}

Code Snippets

Stream live system logs

log stream

Stream logs sent to `syslog` from the process with a specific PID

log stream --process {{process_id}}

Show logs sent to syslog from a process with a specific name

log show --predicate "process == '{{process_name}}'"

Export all logs to disk for the past hour

sudo log collect --last {{1h}} --output {{path/to/file.logarchive}}

Context

tldr-pages: osx/log

Revisions (0)

No revisions yet.