May
13
Grep intelligence – grep lines that DO NOT MATCH an expression
Leave a comment »
I have an apache access log that I need to monitor frequently while users do funny things, but the problem is 99% of the logged calls are some trivial ajax get requests which do stuff, like ‘check new messages’ which, when coming in from each user who has opened the page each second, tend to flood my shell.
In order to filter them out I use tail + grep combo:
tail -f yourapache.log | grep -v ('controller\/check')
This will effectively filter out all *controller/check* calls.
Flag -v in grep manual says: Output only lines which do NOT match