Skip to content

Instantly share code, notes, and snippets.

@fipar
Created April 3, 2014 14:30
Show Gist options
  • Select an option

  • Save fipar/9955427 to your computer and use it in GitHub Desktop.

Select an option

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
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