← Pipes & Filters
Filter the failures
Learn
Filters keep what matters
A filter is a tool that reads text, transforms it, and writes text back out. The
one you'll reach for most is grep PATTERN: it keeps only the lines that match the
pattern and drops the rest.
grep ERROR access.log
grep reads access.log line by line and prints just the lines containing ERROR. Two
details worth knowing:
- It's case-sensitive:
ERRORanderrorare different patterns (grep -iignores case). - It matches anywhere in the line, so
ERRORfinds500 ERRORas well as a line that merely mentions an error.
In access.log, the failed requests are the ones marked ERROR.
Your task
Show only the failed requests — the lines containing ERROR — with grep.