Created
April 3, 2014 14:30
-
-
Save fipar/9955427 to your computer and use it in GitHub Desktop.
split pt-stalk processlist capture into individual files per timestamp, including only the query text and not 'NULL' queries. meant to then feed pt-query-digest --type rawlog
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
| cnt=-1 | |
| f = nil | |
| File.open(ARGV[0]).each_line do |line| | |
| if line.match "^TS" | |
| f.close unless f.nil? | |
| f = File.open(line.gsub(" ","_"), 'w') | |
| else | |
| f.write(line.gsub(" Info: ","")) if line.match " Info: " and not line.match " Info: NULL" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment