15 January 2007 @ 14:33Email that log to me
At one point I decided to have the web server email the day’s access_log to me. Instead of emailing the entire log, I grep’ed through the log to only get “today”, piped that to grep again to exclude entries that contained the IP address of the Intermapper server, and then piped that to mail. So, everyday I have the previous day’s log waiting in my inbox.
#! /bin/sh
today=`date +%d/%b/%Y`
/usr/bin/grep "$today" /var/log/httpd/access_log | /usr/bin/grep -v 192.168.1.70 | /usr/bin/mail -s "access_log for $today" me@email.net
exit 0
I save this shell script and schedule it with cron to run ever day right before midnight.
59 23 * * * /bin/sh /Library/Scripts/mail_log.sh
by Jon | 1 comment | Posted in administration, logs, mail, shell script, webserver | Link to this
This Week on the Command Line: Lieutenant Worf’s favourite distro is?…
I was at the LugradioLive 2007 conference this last weekend which was fab, see here for my take on it.
I am famous, well no, but at the end of the JakAttack podcast 55 [ogg | mp3], they read out my email, rock on!
This post is another of my occasional…