Skip to content

Instantly share code, notes, and snippets.

@vieiralucas
Created April 10, 2015 13:25
Show Gist options
  • Select an option

  • Save vieiralucas/03173bb869867dbe2d02 to your computer and use it in GitHub Desktop.

Select an option

Save vieiralucas/03173bb869867dbe2d02 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var readline = require('readline'),
unflatten = require('flat').unflatten,
logfmt = require('logfmt');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function(line) {
line = 'request.ip' + line.split('- request.ip')[1];
process.stdout.write(JSON.stringify(unflatten(logfmt.parse(line))));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment