Engineering notebook
normalizing Apache Access logs to JSON, XML and syslog
- Published
- AI use
- Human-created
- Filed under
- apache, carnival of logging, cee, libee, log normalization
I like to make my mind up based on examples, especially for complex issues. For a discussion we had on the CEE editorial board, I'd like to have some real-world example of a log file with many empty fields. An easy to grasp, well understood and easy to parse example of such is the Apache access log. Thanks to Anton Chuvakin and his Public Security Log Sharing Site I also had a few research samples at hand.
Apache common log format is structured data. So there is no point in running it through a free-text normalization engine like liblognorm. Of course it could process the data, but why use that complex technology. Instead, the decoder is now part of libee and receives a simple string describing which fields are present. It's called like this:
$ ./convert -exml -dapache -D "host identity user date request status size f1 useragent" < apache.org > apache.xml
Options specify encoder and decoder, and the string after -D tells the convert field names and order. But now let's speak the input and output for itself:
Note that liblognorm works similar and, from libee's point of view, can be viewed at as an decoder for unstructured text data (or, more precisely, for text data where the structure is well-hidden ;)).
Apache common log format is structured data. So there is no point in running it through a free-text normalization engine like liblognorm. Of course it could process the data, but why use that complex technology. Instead, the decoder is now part of libee and receives a simple string describing which fields are present. It's called like this:
$ ./convert -exml -dapache -D "host identity user date request status size f1 useragent" < apache.org > apache.xml
Options specify encoder and decoder, and the string after -D tells the convert field names and order. But now let's speak the input and output for itself:
- input file
- access log in XML format
- access log in JSON format
- access log in syslog RFC5424 structured data format
Note that liblognorm works similar and, from libee's point of view, can be viewed at as an decoder for unstructured text data (or, more precisely, for text data where the structure is well-hidden ;)).