I wrote similar versions of this script over the years to analyze all kinds of logs, but here’s one for posterity:
This script is useful if you have a log for which you want to analyze load over time – transactions per second or whatnot (the version below does this for Apache httpd logs, but it can be easily modified to analyze anything). For apache (and most other HTTP servers) there are many readily available log analysis software packages that do a much better job then what one can do in a simple script, but you might not have such software pre-configured or it can’t filter what you need or you just want to analyze something else – in which case this script will come in handy.
The script receives time stamped log events – each event on a line – and collects the temporal information for each line. Then it will dump a simple vertical graph (i.e. time is on the Y axis) of load over time in the resolution that you want. Its output looks something like this:
Oct 30 14:40:00 2007 |############# | 3.8 x/sec
Oct 30 14:50:00 2007 |########################################## | 6.3 x/sec
Oct 30 15:00:00 2007 |########################################### | 6.5 x/sec
Oct 30 15:10:00 2007 |############################################# | 6.6 x/sec
Oct 30 15:20:00 2007 |############################### | 5.4 x/sec
(more…)