Created
November 3, 2016 13:25
-
-
Save banesto/1cd768c769b1e412d279677a1127217c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# cat <environment>.log | grep Load | grep SELECT | ruby filter.rb | |
MAX_TIME = 300.0 | |
h = {} | |
STDIN.read.split("\n").each do |line| | |
list = line.split(' ') | |
time = list[2].scan(/\((.*)\./).flatten[0].to_f | |
h[list[3]] = time | |
end | |
h.sort_by{ |query, time| time }.reverse.select{ |query, time| time > MAX_TIME }.each do |query, time| | |
puts "#{time} - #{query}" | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment