Jump to content
Toggle menu
  • 51 articles
  • 24 files
  • 4 users
  • 750 edits
Tech-Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Measuring log growth rate (lines per second)

From Tech-Wiki


Monitoring and operational reference for Measuring log growth rate (lines per second).

Reference

The commands below will print how many lines are being generated per second

tail -f file > /tmp/tmp.log & sleep 1; kill $! ; wc -l /tmp/tmp.log ; rm /tmp/tmp.log
tail -f file | pv -l -i10 -r > /dev/null
tail -f file | perl -e 'while (<>) {$l++;if (time > $e) {$e=time;print "$l\n";$l=0}}'
tail -f file | perl -ne 'print time(), "\n";' | uniq -c
tail -f file | python -c 'exec("import sys,time\nl=0\ne=int(time.time())\nfor line in sys.stdin:\n\tt = int(time.time())\n\tl += 1\n\tif t > e:\n\t\te = t\n\t\tprint l\n\t\tl = 0")'

See also