Created
September 26, 2011 16:47
-
-
Save colonD/1242698 to your computer and use it in GitHub Desktop.
Quick fix for logstash slowdowns
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/sh | |
MAILTO=root | |
PID=`ps aux | grep logstash | grep java | grep agent | awk '{print $2}'` | |
LLEN=`redis-cli LLEN logstash` | |
LLENMAX="50" | |
if [ "x$PID" = "x" ]; then | |
PID=-1 | |
fi | |
if [ $PID -eq -1 ]; then | |
echo "Logstash not running" | |
exit 1 | |
else | |
if [ $LLEN -gt $LLENMAX ]; then | |
kill $PID | |
logger "Killed logstash PID $PID because redis LLEN exceeds $LLENMAX @ $LLEN" | |
fi | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment