A program for parsing CouchDB logs
var LogParse = require('couchdb-log-parse')
var parser = new LogParse()
fs.createReadStream('couchdb.log').pipe(parser)
parser.on('data', function (c) {
// this is the raw data, don't know why you need this, but whatever
})
parser.on('message', function (message) {
// this is probably what you want.
// it's the parsed object with informative fields
})
The parsed messages all have these fields:
dateThe date that the log was postedlevelUsually one of info, warn, or errorpidNot a real pid. Some kind of silly erlang goober.typeEither 'http', 'erl', or 'misc'
Depending on the type they may have the following fields as well:
ipThe requesting IP. (If you're behind a proxy or load balancer, then it's not super interesting.)methodSomething like GET, POST, PUT, etc.urlThe url requestedstatusCodeThe response status code.
messageWhatever comes before the dump. Sometimes blank.dumpThe dumped erlang object. (If someone wants to write a parser for the erlang objdump notation, that'd be rad.)
messageWhatever it was that couldn't be parsed.