Skip to content

Instantly share code, notes, and snippets.

@wimleers
Created April 26, 2011 22:28
Show Gist options
  • Save wimleers/943336 to your computer and use it in GitHub Desktop.
Save wimleers/943336 to your computer and use it in GitHub Desktop.
Script to automatically analyze slow queries of last hour and last 24 hours, using mk-query-digest.
#!/bin/sh
INPUT=/var/log/mysql/mysql-slow.log
OUTPUT_1H=/data/www/wimleers.com/status/mysql-slow-1h.txt
OUTPUT_24H=/data/www/wimleers.com/status/mysql-slow-24h.txt
# Perform the analytics, overwriting the previous results.
../scripts/mk-query-digest --since 1h $INPUT > $OUTPUT_1H
../scripts/mk-query-digest --since 24h $INPUT > $OUTPUT_24H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment