When following a log file with the tail
command you are typically looking for a specific pattern. If the log output is verbous it can be difficult to catch the lines your interested in. For example a PHP log file might contain many PHP Notice:
entries but your only interested in lines containing PHP Fatal error:
. To grep the output of tail
simply tell the grep
command to red from stdin and pipe the output from tail
to grep
as follows.
tail -f {path/to/log/file} | grep 'PHP Fatal error:' -