Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
jq example files
reduce inputs as $obj (
{};
if $obj.severity == "E" then
. + {
($obj.severity): (.[$obj.severity] + 1)
}
else
.
end
)
reduce inputs as $obj (
{};
. + {
($obj.severity): (.[$obj.severity] + 1)
}
)
reduce inputs as $obj (
{};
if ($obj.error.msg|test("widget";"i")) then
. + {
($obj.severity): (.[$obj.severity] + 1)
}
else
.
end
)
{"ts":"2017-11-30 06:45:02","severity":"I","error":{"msg":"Reticulating splines","splines":1}}
{"ts":"2017-11-30 06:45:12","severity":"I","error":{"msg":"Probing froobles (Widget 5)","names":["frb23","frb42"]}}
{"ts":"2017-11-30 06:45:57","severity":"E","error":{"msg":"Widget exploded"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment