This file contains 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
#!/bin/bash | |
(/usr/local/bin/db2log | \ | |
mk-query-digest --fingerprints \ | |
--filter '$event->{user} !~ m/^(bi|memonic)$/') 2>&1 | \ | |
mail -s "MySQL slow logs" root | |
# Rotate slow logs. Will move them into the backup table slow_log_backup. If | |
# that table exists it's overwritten with the primary slow log. | |
# So with this strategy we can still access yesterday's slow log by querying | |
# slow_log_backup. |