Skip to content

Instantly share code, notes, and snippets.

@colonD
Created September 26, 2011 16:47
Show Gist options
  • Save colonD/1242698 to your computer and use it in GitHub Desktop.
Save colonD/1242698 to your computer and use it in GitHub Desktop.
Quick fix for logstash slowdowns
#!/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