Linux tail command

Linux tail command … here is a solution to the problem.

Linux tail command

I’m not sure if this can be done, but with Linux, you never know its limitations.

I’m tracking the apache logs:

\#tail -f apachelog.access-log

It gets what I want

, but I want to narrow down what it returns. This is the typical line I will get:

2011-01-28T04:20:59-07:00 SERVER03 apache: 10.0.0.1 - - [28/Jan/2011:04:20:59 +0000] "POST /a/ HTTP/1.1" 200 4461 "http://somesite.net/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13"

Is it possible to filter my smeared content?
Sometimes, I just want to see the referring site. Sometimes I want to look at 2 or 3 other items.

Solution

You can easily perform :

tail -f apachelog.access-log | grep SERVER03

THIS WILL ONLY GIVE YOU LINES THAT CONTAIN THE STRING SERVER03.

Related Problems and Solutions