On Fri, 7 Nov 2003, Martin Hamilton wrote:
| On Fri, Nov 07, 2003 at 09:22:10AM +0000, Ron McKeating wrote:
|
| | One our linux gurus Martin Hamilton does it with a perl script. i have
| | cc'd him into this mail, and if he not too busy he might tell you
| | himself how it works.
|
| Hi folks - see http://martinh.net/txt/exim-mrtg.html
Good stuff.
It does seem a slight shame to re-read the whole logfile each time.
Another option might be a process which essentially does a "tail -f" on
the log and increments counters as appropriate.
I remember ages ago Nigel suggested the perl File::Tail module. This
*almost* worked for us but seemed to occasionally get confused and rewind
back to start of file for no apparent reason - causing a huge spike in the
graphs. Never found a solution.
FWIW we now just do the "tail -f" thing ourselves in perl - something like:
for (;;)
{
while ( <LOG> )
{
# while input present, process a log line
# etc
}
# write out the stats
# wait a bit
sleep 60;
# Clear end-of-file condition ( with a seek no-op ):
seek(LOG, 0, 1);
}
--
Chris Edwards, Glasgow University Computing Service