Log & Hip Hop

If server logs could rap, they’d sound a lot like Mike Jones: Back then you didn’t tail me / Now I’m hot you all grep me! (See what I did there?)

Jokes aside, if you’re working with logs that span a long period of time, check out Chainsaw. Written by Travis Dunn, it analyzes log files and returns entries for subset time periods.

Chainsaw automatically recognizes common log formats (Apache, Nginx, Ruby, Python, Rails, MongoDB, etc) and is super flexible. You can use relative (last week), complex (2 months ago Sunday at 1:00 pm), and specific (2013-10-01 - 2013-11-15) time strings. It also has a text filter so you can query simultaneously for time & content.

```bash $ chainsaw access.log 2 months ago Sunday at 1:00 pm # return log entries from target time until now.

$ chainsaw access.log -f GET last week # return all entries from last week forward containing the phrase GET.

$ chainsaw access.log -i october - 2013-11-15 # return entries from october through the middle of november and print them one-by-one when you hit return. ```

Chainsaw is easy to use, efficient, and plays well with others:

And before I succumb to the ‘itis’, I’d like to give thanks. I’m thankful for your support, readership, and awesome feedback. Happy Turkey Day!

Join the discussion

2017 Neal Shyam