Pipe logs to Claude
Triage a log file without leaving the terminal.
Official basis Pipe data straight in and use non-interactive (headless) mode. docs ↗
The prompt
tail -n 200 <logfile> | claude -p "Flag any anomalies or errors in these logs and name the most likely root cause." Why it works
claude -p runs headless, so you can feed it data from a pipe and get a one-shot
answer — perfect for logs, CI output, or grep results you don’t want to paste by
hand.
Fill in
<logfile>— the log (or swaptailfor any command that emits the data).
Follow-ups
- “Pipe the surrounding 500 lines and confirm the anomaly’s first occurrence.”