Friday, June 22, 2007

grep goodness

So as a sys admin I find myself looking at logs most of the time. And with the volume and size of our mail logs its handy to know some nifty tricks about grepping logs and such. Here is one good trick I learned

tail -f <log file > | grep <thing you want to search for >


So what tail -f does is it will output the tail of the log file, and the -f switch will not stop the tail but instead it will keep the log file open which means you can watch logs happen in real time. And then you pipe it to grep which search for the thing you want to search for. Easy? I know its a life helps me do my job a little easier :)

No comments: