Skip to content

Instantly share code, notes, and snippets.

@gbirke
Last active August 31, 2019 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbirke/84ed97eb208f09a5e3c1ccd0e6a2a89f to your computer and use it in GitHub Desktop.
Save gbirke/84ed97eb208f09a5e3c1ccd0e6a2a89f to your computer and use it in GitHub Desktop.
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