Skip to content

Instantly share code, notes, and snippets.

@lacostenycoder
Created December 20, 2019 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lacostenycoder/aed960450f51db6a0aecd039e4b10867 to your computer and use it in GitHub Desktop.
Save lacostenycoder/aed960450f51db6a0aecd039e4b10867 to your computer and use it in GitHub Desktop.
Sum redis call_time from log file
#!/usr/bin/env ruby
# pass log filename as single argument
filename = ARGV[0]
lines = File.readlines(filename).select{|l| l =~ /call_time/}
puts filename
puts lines.map{|l| l[/\d+.\d+\b/].to_f}.reduce(&:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment