ntail

A tail(1)-like utility for nginx log files that supports parsing, filtering and formatting of individual log lines (in nginx’s so-called “combined” log format).

<a name=“intro”/>

Check it out, yo!

Instead of this…

$ tail -f /var/log/nginx/access.log
192.0.32.10 - - [21/Jan/2011:14:07:34 +0000] "GET / HTTP/1.1" 200 3700 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" "-"
192.0.32.10 - - [21/Jan/2011:14:07:34 +0000] "GET /nginx-logo.png HTTP/1.1" 200 370 "http://localhost/" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" "-"
192.0.32.10 - - [21/Jan/2011:14:07:34 +0000] "GET /poweredby.png HTTP/1.1" 200 3034 "http://localhost/" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" "-"
192.0.32.10 - - [21/Jan/2011:14:07:34 +0000] "GET /favicon.ico HTTP/1.1" 404 3650 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" "-"
192.0.32.10 - - [21/Jan/2011:14:19:04 +0000] "GET /nginx-logo.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" "-"
$ _

… you get this:

$ tail -f /var/log/nginx/access.log | ntail
2011-01-21 14:07:34 -       192.0.32.10 - 200 - GET / - (Chrome, Linux) - -
2011-01-21 14:07:34 -       192.0.32.10 - 200 - GET /nginx-logo.png - (Chrome, Linux) - localhost
2011-01-21 14:07:34 -       192.0.32.10 - 200 - GET /spanoweredby.png - (Chrome, Linux) - localhost
2011-01-21 14:07:34 -       192.0.32.10 - 404 - GET /favicon.ico - (Chrome, Linux) - -
2011-01-21 14:19:04 -       192.0.32.10 - 304 - GET /nginx-logo.png - (Chrome, Linux) - -
$ _

<a name=“installation”/>

Installation

Installing the gem also installs the ntail executable, typically as /usr/bin/ntail or /usr/local/bin/ntail:

$ gem install ntail

To ensure easy execution of the ntail script, add the actual installation directory to your shell’s $PATH variable.

<a name=“basic”/>

Basic Usage

<a name=“advanced”/>

Advanced Examples

<a name=“todo”/>

TODO

<a name=“acknowledgements”/>

Acknowledgements

<a name=“contributing”/>

Contributing to ntail

<a name=“copyright”/>

Copyright © 2011 Peter Vandenberk. See LICENSE.txt for further details.