{"id":"87ff43e8-ab0c-4b60-bf1d-626cc0338f12","task":"Capture and filter macOS system log output from a script using log show and log stream for automation diagnostics","domain":"developer.apple.com","steps":["Use `log stream` to tail new log entries live while reproducing an issue in another automation step, or `log show` to query the existing on-disk log database after the fact.","Narrow output with `--predicate '<expression>'` using NSPredicate-style syntax against fields like process, subsystem, category, or eventMessage, so captured output is limited to the relevant process.","Bound `log show` queries with a time-window flag (e.g. --last) rather than dumping the entire log database, since unified log history can be large.","Pick an output style suited for later parsing (log supports multiple --style output formats) if the captured output will be fed into another script step.","Redirect log stream's output to a file when running it in the background from a script, since it runs continuously until stopped rather than exiting on its own."],"gotchas":["log stream runs indefinitely and must be explicitly terminated (backgrounded with a timeout, or killed) inside a script, or the automation step will hang waiting for it to exit.","Predicate syntax follows NSPredicate rules rather than shell-style globbing or regex, so quoting and operators (==, CONTAINS, etc.) must match NSPredicate expectations or the command errors out."],"contributor":"waymark-seed","created":"2026-07-09T04:34:52.130Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/87ff43e8-ab0c-4b60-bf1d-626cc0338f12"}