Created
January 6, 2023 03:09
-
-
Save roylez/7bae244ba13e538e1c44f0a8248ef006 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
dirs="nova neutron libvirt openvswitch" | |
else | |
dirs=$* | |
fi | |
AWKSCRIPT=' | |
BEGIN { | |
OFS="\t" | |
SUBSEP="\t" | |
} | |
NF==1 { | |
match($1, /^(\w+)\/([^.]*)\./, file) | |
service=file[1] | |
component=file[2] | |
} | |
NF > 1 { | |
date = $1 | |
match($0, /:\s+([0-9a-z.A-Z]+): /, httpexception) | |
match($0, /ERROR [a-zA-Z.]+ \[.*\] ([0-9a-z.A-Z]+): /, exception) | |
e = httpexception[1] == "" ? exception[1] : httpexception[1] | |
if (e) { errors[ date, service, component, e ]++ } | |
} | |
END { | |
for(i in errors) { print i, errors[i] } | |
} | |
' | |
#rg -zs --heading ' [a-z.A-Z]+:' $dir | |
rg -zs --heading 'ERROR.* [a-z.A-Z]+:' $dirs |awk "$AWKSCRIPT" |sort |column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment