logmap

Filter streams of json and format the output using [JSONSelect][0]

SYNOPSIS

Filter streams of json and format the output using JSONSelect

MOTIVATION

bunyan has too much ceremony, jsontool isn't specific enough for the task.

INSTALL

npm install logmap -g

USAGE

cat test/fixtures/sample.json | logmap ".date, .loglevel, .value" -f "[%d]: (%s) %s"
{ "date": "1369605255506", "loglevel": "info", "value": "Lorem ipsum dolor sit amet.", "title": "C++", "id": "001" }
{ "date": "1369605255507", "loglevel": "info", "value": "Mollit anim id est laborum.", "title": "Javascript", "id": "002" }
[1369605255506]: (info) Lorem ipsum dolor sit amet.
[1369605255507]: (info) Mollit anim id est laborum.

Because JSONSelect gets the data in the order that it is found, you may need to specify a special grammar not yet supported by JSONSelect. Below is an example of the grammar and data.

cat test/fixtures/sample.json | logmap ".date; .loglevel; .value" -f "[%d]: (%s) %s"
{ "title": "C++", "id": "001", "loglevel": "info", "value": "Lorem ipsum dolor sit amet.", "date": "1369605255506" }
{ "title": "Javascript", "id": "002", "loglevel": "info", "value": "Mollit anim id est laborum.", "date": "1369605255507" }
[1369605255506]: (info) Lorem ipsum dolor sit amet.
[1369605255507]: (info) Mollit anim id est laborum.

OPTIONS

If you write a long query, you can save it so you don't have to write it again.

cat test/fixtures/sample.json | logmap ".date, .loglevel, .value" -f "[%d]: (%s) %s" -s myQuery
cat test/fixtures/sample.json | logmap -l myQuery
logmap -d myQuery