Parsing logs with grep

From Newroco Tech Docs
Revision as of 09:34, 18 October 2017 by Chris.puttick (talk | contribs) (Created page with "When tracing faults, going through log files with the aid of ''grep'' is an incredibly powerful way to isolate the informative entries from the noise. You can nest grep output...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

When tracing faults, going through log files with the aid of grep is an incredibly powerful way to isolate the informative entries from the noise. You can nest grep output with |, so you can slowly remove entries from your output that aren't related to the issue you are trying to understand.

The basic use of grep is

grep pattern filetolookin

where filetolookin can include wildcards; you can also pass output to grep e.g.

tail -f mylogfile|grep pattern

and the output from grep can be passed to grep to refine your output

grep pattern filetolookin|grep pattern2|grep pattern3