Skip to content

Instantly share code, notes, and snippets.

@Jaretbinford
Created August 22, 2016 18:35
Show Gist options
  • Save Jaretbinford/34575be7cfaf4c85656117adb67de699 to your computer and use it in GitHub Desktop.
Save Jaretbinford/34575be7cfaf4c85656117adb67de699 to your computer and use it in GitHub Desktop.
updated metric-grep to pull all vars for a given metric
#!/usr/bin/env bash
function metric-grep () {
cat *.log | perl -n -e 'print "$1 $2\n" if /^(.*) INFO .* '"$1"' {.*?'"$2"' (.*?)\}/' | less
}
# call like:
# metric-grep :StorageGetMsec
# output example
# 2016-07-30 00:00:27,557 0, :hi 276, :sum 14598, :count 1686
# 2016-07-30 00:01:27,557 0, :hi 1980, :sum 26578, :count 4626
# 2016-07-30 00:02:27,557 0, :hi 74, :sum 13432, :count 1925
# 2016-07-30 00:03:27,558 0, :hi 81, :sum 8850, :count 1482
# 2016-07-30 00:04:28,821 0, :hi 63, :sum 6647, :count 992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment