Created
March 21, 2016 19:33
-
-
Save nicwaller/39c8f1a6e973b585f8ab to your computer and use it in GitHub Desktop.
Output the worst SLOWLOG entry from each Redis instance on a server, in descending order from slowest to fastest.
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 | |
# Example output: | |
# ~$ ./slowlog_all.sh | |
# 1779.2 ms /etc/redis/reports.conf | |
# 65.934 ms /etc/redis/actions.conf | |
for file in $(ls -1 /etc/redis/*.conf); do | |
name=$(basename $file); | |
port=$(awk '/^port/ {print $2}' $file); | |
redis-cli -p $port slowlog get 1 2>/dev/null | head -n4 | xargs -n4 echo | awk '{printf $3/1000 " ms "}'; | |
echo $file; | |
done | sort -rn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment