Skip to content

Instantly share code, notes, and snippets.

@csquared
Created September 13, 2013 01:32
Show Gist options
  • Select an option

  • Save csquared/6545920 to your computer and use it in GitHub Desktop.

Select an option

Save csquared/6545920 to your computer and use it in GitHub Desktop.
var split = require('split');
var logfmt = require('logfmt');
var through = require('through');
var _ = require('underscore');
var list = []
var parseLine = function(line){
if(/INFO/.test(line)) return;
var data = logfmt.parse(line);
data.json_size = (parseInt(data.json_size) / 1024) / 1024
list.push(data)
}
var end = function end(){
console.dir(_.sortBy(list, 'json_size').reverse().slice(0,16))
}
process.stdin.pipe(split()).pipe(through(parseLine, end))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment