Pardon for the location of this post, but it really doesn't fit anyplace else. If you think it would be better someplace else, let me know.

Anyway, I manage a farm of servers for a government contractor (and no, we don't use cookies to track your life). Frequently I am asked to parse and compile large volumes of logs to extract various bizarre information. I have for many years just parsed the standard output from Apache. However, today, out of boredom, I decided to make that easy task simpler.

I wrote the following LogFormat for Apache that works quite well. It allows you to read in a line of the log and assign it directly to a hash. Like this:

while (<LOGFILE>) { my %hash=eval $_; ## do something with %hash }
The LogFormat is like this:
LogFormat "(bytes=>'%b',filename=>'%f',remotehost=>'%h',remoteip=>'%a' +,remoteuser=>'%l',serverport=>'%p',pid=>'%P',request=>'%r',status=>'% +s',time=>'%t',timeserve=>'%T',authuser=>'%u',url=>'%U',virtual=>'%v') +" log_perl
Not terribly exciting, or unique or difficult; but helpful.

In reply to Perl readable Weblogs by mr.nick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.