tail -f | grep -v “foo” | grep -v “bar” | grep -v “baz”

That looks pretty standard, right? Most of the time CLI one liners are good. Sometimes they are slow or we are just down right doing something wrong.

Our syslog at work moves so fast on our Development Vagrant Instances and you need more granularity when tailing them.

Traditionally, I would start by tailing syslog tail -f /var/log/syslog

Now start omitting specific logs lines (–invert-match | -v) that match the term.

tail -f /var/log/syslog | grep -v "access" | grep -v "apache"

Once you are piping through multiple grep invert matches tail chokes up a bit and isn’t as “real time” as you need it to be or at least as I want it to be.

Using a single grep and simple (or | ) statements when invert matching the logs seems to speed it up quite a bit.

tail -f /var/log/syslog | grep -v "access\|apache\|access\|..." works like a charm. It doesn’t have to keep piping the results through and has much more of a “real time” feel to it.

 
3
Kudos
 
3
Kudos

Now read this

Finally, It’s Happening…

I’ve been talking about the concept of a blog for quite some time but Life happens and plus writing Code trumps writing Paragraphs. ;) I started building a Blog out with Jekyll a while ago, “Transform your plain text into static websites... Continue →