Download here

NAME

clf2xml -- convert Common Log Format files to XML

SYNOPSIS

 % clf2xml web_server_access.log > hits.xml

Or to take a closer look:

 % tail -1 stuff.log
 
 65.74.65.44 - banjo [25/Jul/2005:14:07:53 -0700] "GET /cgis/
 docs/?action=edit&page_id=k%C3%ADl HTTP/1.1" 200 3228 "http:
 //www.google.com/search?num=30&hl=en&lr=&c2coff=1&q=haida+k%
 C3%ADl&btnG=Search" "Mozilla/5.0 (Windows; U; Windows NT 5.1
 ; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6"
 
 % tail -1 stuff.log | clf2xml
 
 <hits>
 
 <hit
  xml:id = "L-1"
  user_hostname = "65.74.65.44"
  user_ident = ""
  user_http = "banjo"

  date = "2005-07-25T14:07:53-0700"
  date_year   = "2005"
  date_month  = "07"
  date_day    = "25"
  date_hour   = "14"
  date_minute = "07"
  date_second = "53"
  date_timezone_offset = "-0700"
 
  host = ""
  path = "/cgis/docs/"
  querystring = "action=edit&#38;page_id=k%C3%ADl"
  path_and_query = "/cgis/docs/?action=edit&#38;page_id=k%C3%ADl"
 
  method = "GET"
  status = "200"
  protocol = "HTTP/1.1"
  bytes_returned = "3228"
  useragent = "Mozilla/5.0 (Windows;&#32;U;&#32;Windows NT 5.1;
 &#32;en-US;&#32;rv:1.7.10) Gecko/20050716 Firefox/1.0.6"
 
  refer = "http://www.google.com/search?num=30&#38;hl=en&#38;lr
 =&#38;c2coff=1&#38;q=haida+k%C3%ADl&#38;btnG=Search"
  refer_query = "num=30&#38;hl=en&#38;lr=&#38;c2coff=1&#38;q=
 haida+k%C3%ADl&#38;btnG=Search"
  refer_http_host = "www.google.com"
 >
   <query>
        <param  name = "action"   value = "edit" />
        <param  name = "page_id"  value = "k&#237;l" />
   </query>
   <refer_query>
        <param  name = "num"    value = "30" />
        <param  name = "hl"     value = "en" />
        <param  name = "lr"     value = "" />
        <param  name = "c2coff" value = "1" />
        <param  name = "q"      value = "haida k&#237;l" />
        <param  name = "btnG"   value = "Search" />
   </refer_query>
 </hit>
 
 
 </hits>

DESCRIPTION

This is a small Perl utility to convert an Apache(-style) Common Log Format log file into XML.

OPTIONS

Run "clf2xml --help" to list all the options.

COPYRIGHT AND DISCLAIMER

Copyright (c) 2005 Sean M. Burke. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The programs and documentation in this file are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

AUTHOR

Sean M. Burke, sburke@cpan.org