Skip to content

Instantly share code, notes, and snippets.

@jplindstrom
Created September 27, 2016 09:51
Show Gist options
  • Save jplindstrom/db97b1ee322eb37dcb00741ac3cb52b0 to your computer and use it in GitHub Desktop.
Save jplindstrom/db97b1ee322eb37dcb00741ac3cb52b0 to your computer and use it in GitHub Desktop.
Display the length of time between log lines.
# Assumes the first digit is a timestamp, and that all of them have the same width. Most useful with ms precision.
# tail -f logfile | THIS_FILTER
perl -MList::Util=min -nE 'state $last= 0; /"([\dT:,-]+)"/ and do { my $c = ($1 =~ s/\D//gr); my $d = $c - $last; my $w = min(200, $d / 5); say $d . ": " . ("x" x $w); $last = $c }; print $_'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment