log2json: Turn log file records into JSON.

[ json, library, logging, program, text, tools, utils ] [ Propose Tags ] [ Report a vulnerability ]

Take an httpd.conf style LogFormat string and parse log files into JSON records.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Dependencies base (>=3 && <5), containers, json (==0.3.6), parsec (>=3) [details]
License LicenseRef-GPL
Author harold@hotelling.net
Maintainer harold@hotelling.net
Category Logging, JSON, Text, Utils, Tools
Home page https://github.com/haroldl/log2json
Bug tracker https://github.com/haroldl/log2json/issues
Source repo head: git clone git://github.com/haroldl/log2json.git
Uploaded by HaroldLee at 2012-11-02T06:32:40Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables log2json
Downloads 1157 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for log2json-0.1

[back to package description]

log2json

The log2json command takes the LogFormat string to use and a list of filenames as command-line arguments. If nothing is supplied, it goes into "demo" mode, prompting you for a LogFormat and a single log record to parse.

log2json '%b' a.log b.log

LogFormat

LogFormat is a Haskell module that makes it trivial to parse access log records.

LogFormat will take the LogFormat configuration from your httpd.conf file and a log file and give you your log records as Maps where the key is the field name.

The Apache httpd configuration files allow you to customize the format of your log file records using the LogFormat directive. For example, if you want every line of your access log to read "Hello Web" you can do that like so:

LogFormat "Hello Web" custom

More often you'll use a value such as

LogFormat "%h %l %u %t \"%r\" %>s %b" common

and receive log records like

127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326