Skip to content

Instantly share code, notes, and snippets.

@ausuwardi
Created July 7, 2017 06:45
Show Gist options
  • Save ausuwardi/7dfe9655ca5f4bd516e8d44a4778ebb7 to your computer and use it in GitHub Desktop.
Save ausuwardi/7dfe9655ca5f4bd516e8d44a4778ebb7 to your computer and use it in GitHub Desktop.
Count 'concurrent update' error in postgresql, sum per hour
zcat /var/log/postgresql/postgresql-9.6-main.log.3.gz | grep 'due to concurrent update' | awk 'BEGIN {time="--"; count=0} {x=substr($2,1,2); if (time !=x) {printf "%s,%d\n", time, count; time=x; count=0;} count=count+1;} END {printf "%s,%d\n", time, count}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment