Apache Log Notifications in Linux

A NotifyOSD notification of log activity
A NotifyOSD notification of log activity

I have a small personal website, as you can see, that gets the odd visitor now and then. This makes me happy! so I like to know about it. There are plenty of statistic gathering scripts like Google Analytics that generate excellent aggregate data, but for my scale of website I prefer a more fine-grain monitoring. I use BBClone for this and it does an awesome job. Other than wishing it had the option for a SQL back-end, I always thought it would be great to have a real time notification of someone paying a visit.

Thus my java ApacheLogNotifier was born!

Using Java and Ubuntus port of NotifyOSD via the notification demon, I have created a small program to poll the tail of my Apache log and notify me whenever there is interesting activity. At the moment I ignoring localhost and bots, so that I can see if an actual person has just come to visit my website. There is a lot of work and refactoring to be done. My initial prototype is just a rushed couple of hours work (thanks to reusing the tail code from http://www.informit.com/guides/content.aspx?g=java&seqNum=226).

For more information and to get the code look at the wiki page.

WhereAmI Plugin Update

So far I have made a small PHP script for displaying where I am based upon a timetable (More info at WhereAmI.) Its still not a WordPress widget because I haven,t sorted out how to call the code within widgets.

I have all the information stored in a CSV file, but I might change this at some point. Its nice having the ability to edit it with Excel, but for some reason it doesn’t like to save Comma-Separated Value files with commas… you have to keep telling Excel you want them, go figure. This was one of my first attempts at actually coding in PHP rather than changing variables in an existing script. It went quite well, however It took me a little while to realise the epoch isn’t represented as midnight on Jan 1 1970 for my apparent system time, but rather time zone adjusted… It was all a little odd. One of the features I am thinking about adding to the script after I widgitise it, is the ability to override the current value e.g. quickly set it to ‘out of the office’. This could possibly be set with an expiry before going back to the timetable. A PHP interface for setting the timetable could be nice too.