Lyte's Blog

Bad code, bad humour and bad hair.

Tracking Yourself in Apache Logs

Sometimes I want to filter out all log lines that aren’t generated by me when I’m debugging a problem with web servers.

At some point I worked out this trick and I thought I’d share it for others.

In Firefox it’s relatively trivial to add a unique string to your useragent. Fire up the about:config interface and add a new key like general.useragent.extra.yourname with a unique value: about:config

Then you can simply grep for your unique string in access logs:

root@foo:/var/log/apache2# tail -f access.log | grep 'lyte - asdf123123' - - [11/Mar/2011:01:48:06 +1100] "GET / HTTP/1.1" 200 497 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110221 Ubuntu/10.04 (lucid) Firefox/3.6.14 lyte - asdf123123"