Creating Data Sets with Data::Xtab

When you are working with real-world data from normalized tables or from database engines, you will find that the data will often require a good deal of manipulation to get it into a well-formed GIFgraph data set format. The Data::Xtab module, available on CPAN, was written by Brian Jepson as a tool for making this sort of raw data easier to graph. It will “cross-tabulate” data from one form into another that is easy for GIFgraph to digest.

Take as an example the case of creating a graph based on the contents of an access log for a proxy server. Let’s say that there are three computers on a network that all share the same proxy server for access to the Internet. For each HTTP request, an entry is made in a log file called proxy-log. The format for each entry in the log in this example is the same format as that of the httpd-cern proxy server:

host - - [day/month/year:hour:minute:second zone]
"GET url version" status bytes

Or, looking at a few lines of the actual log file:

               burroughs.as220.org - - [07/Feb/1998:23:35:06 +0500] 
    "GET http://flatzilla.as220.org/images/spacer.gif HTTP/1.0" 200 61
               snuggles.as220.org - - [07/Feb/1998:00:45:38 +0500] 
    "GET http://flatzilla.as220.org/images/image.gif HTTP/1.0" 200 1624
               snuggles.as220.org - - [08/Feb/1998:00:45:39 +0500] 
    "GET http://flatzilla.as220.org/images/single.gif HTTP/1.0" 200 1499
               gumbo.as220.org - - [08/Feb/1998:01:12:12 +0500] 
    "GET http://flatzilla.as220.org/images/beatniks.gif HTTP/1.0" 200 1744 ...

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.