Back to commands

Hosting Operations

Read-only, can be slow

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

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

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.

Expected output

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

System impact

Read-only, can be slow. Nothing changes. The command reads log files and prints matching lines.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

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.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ 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

$ 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
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

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

next steps

Related commands

Hosting Operations Can be slow

Scan Every CI Log for Error Lines

One grep pass can turn a log pile into a failure list.

grep -RInE 'error|failed|failure|exception|traceback' artifacts logs | head -50
Hosting Operations Can be slow

Count Request IDs in Error Lines

Repeated request IDs can connect separate error lines to one failing path.

grep -Ei 'error|timeout|fatal|exception' fixtures/incidents/app.log | awk '{for (i=1;i<=NF;i++) if ($i ~ /^request_id=/) print $i}' | sort | uniq -c | sort -nr
Hosting Operations Can be slow

Find Tests That Passed After Rerun

A green retry can still hide a flaky test.

grep -RInE 'rerun|retry|flaky|passed on retry|failed attempt' artifacts logs
Hosting Operations Can be slow

Find Coverage Regression Lines

Coverage failures usually say the threshold out loud.

grep -RInE 'coverage|threshold|minimum|below' artifacts logs
Hosting Operations Read-only

Count App Errors by Minute

A minute-by-minute count shows whether an incident is a spike or a drip.

awk 'tolower($0) ~ /(error|fatal|timeout|exception)/ {minute=substr($1,1,16); count[minute]++} END {for (m in count) print count[m], m}' fixtures/incidents/app.log | sort -nr
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:103-gnu-unix-commands
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.