This document is available on the Internet at:  http://urbanmainframe.com/folders/blog/20041107/folders/blog/20041107/

Chasing Your Tail

Date:  7th November, 2004

Tags:

Dog, chasing it's tail.

I've just discovered the *nix command, tail - and what a useful command it is.

In its simplest form, tail displays the last 10 lines of a file. Now I appreciate that this doesn't sound very exciting, but tail has a particularly useful trick up its sleeve... the -F option.

When used with the -F option, tail will automatically follow a file, continually sending appended data to standard output.

If you're still not excited, connect to your web-server, with telnet or an SSH client, and enter the following command:


tail -F /usr/local/apache/logs/access_log


(Substitute /usr/local/apache/logs/access_log for the path to your web-server's "access_log" file.)

You should see a log of access requests for your website that is updated in real-time!

tail is great for watching any log: accesses, errors, firewall, IDS, proxy, etc.