I needed to summarize number of bugs per week per user
cat postgresql-*.json | \ jq -r 'select(.error_severity=="ERROR") | select (.application_name | (startswith("pgAdmin") or startswith("IntelliJ"))) ' | \ jq -rs 'group_by (.user, .message) | map({user: .[0].user, message: .[0].message, count: length}) | .[] | [.count, .user, .message] | @tsv'I had to learn so grouping inside
jq
is allowed only on json array (and result is an array again), so I needed to merge
input records to array by using -s
, --slurp
option. For final processing, I need to translate result array just
to set of records by syntax .[]
. Transformation to tsv (tab separated data) are used for better readability than csv.