Back to lessons

Hosting Operations

Tail the Failing CI Lines

A build log is thousands of lines long and the useful error is buried near the end.

Command

grep -RInE 'error|failed|exception|traceback|fatal' logs/ | tail -50

What changed

Nothing changes. The command reads log files and prints matching lines.

Danger

safe

When to use it

Use when triaging build, test, or deployment logs locally.

When not to use it

Do not use it as your only parser when the log format has structured fields better queried with jq or a log system.

Undo or recovery

No undo needed because this command is read-only.

Expected output

A short list of matching log lines with filenames, line numbers, and error text.

demo script

Disposable terminal steps

  1. sed -n '1,20p' logs/build.log
  2. grep -RInE 'error|failed|exception|traceback|fatal' logs/ | tail -50

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ sed -n '1,20p' logs/build.log
INFO setup complete
error test failed in checkout.spec.ts
fatal deploy stopped before release switch
Traceback: deploy.py line 42
::exit-code::0
$ grep -RInE 'error|failed|exception|traceback|fatal' logs/ | tail -50
logs/build.log:2:error test failed in checkout.spec.ts
logs/build.log:3:fatal deploy stopped before release switch
::exit-code::0

YouTube Short

Find CI failures fast.

When CI dumps a huge log, do not start at line one. Grep for failure language and keep the last fifty hits.

LinkedIn hook

Skip the full CI log and jump straight to lines that usually explain the failure.

Question: What is the first command you run when a CI log is too noisy?

experiments

A/B tests to run

Metric: shorts_completion_rate

A: Skip the full CI log.

B: Find the one line that broke CI.