Sat, 16 Oct 2004
Apache Error log to Access log date converter
As part of my daily server housekeeping I keep an eye on the Apache error
logs for each of the servers I'm responsible for. If it's a quiet day I'll
grep through the attempted exploits, attacks and formmail scans for any
useful error messages. While attempting to track some 404's back to the
corresponding access-log entries I got bored of converting the error logs
date format into the default date format of the access log so I wrote a
small bit of shell that I (badly) named
ApacheErrorDate.sh but
without the studly caps, to do it for me.
You invoke the script on the command line with a single argument, the error log date string you want to convert. The script will then return a string in the access log format. If you want to paste the returned string directly into your editor of choice (I tested this with vim) then you can supply the -e option to have the slashes escaped to stop vim treating it as a substitution command.
I've added the short script, with a download link and brief introduction, to the MiniProjects page under the Apache Error log to Access log date converter header.
Like this post? - Digg Me! | Add to del.icio.us! | reddit this!
Posted: 2004/10/16 16:47 | /tools/commandline | Permanent link to this entry | This entry and same date

