Skip to content

Instantly share code, notes, and snippets.

@ankitdbst
Created July 20, 2019 06:33
Show Gist options
  • Save ankitdbst/73398b8ffc280838dd2ceb3775de21a1 to your computer and use it in GitHub Desktop.
Save ankitdbst/73398b8ffc280838dd2ceb3775de21a1 to your computer and use it in GitHub Desktop.
Monitor Nginx + Magento server logs.
echo "Stopping monitoring if running..."
./stop-monit.sh
declare WEBHOOK="https://hooks.slack.com/services/..."; # your web-hook
echo "Starting monitoring..."
nohup ./tail-slack.sh /var/log/nginx/access.log $WEBHOOK " 50[0-3]\{1\} \| 40[0-3]\{1\} " >/dev/null 2>&1 &
nohup ./tail-slack.sh /var/log/nginx/error.log $WEBHOOK "[error]" >/dev/null 2>&1 &
nohup ./tail-slack.sh /var/www/html/current/var/log/exception.log $WEBHOOK "main\.ERROR\|main\.CRITICAL" >/dev/null 2>&1 &
nohup ./tail-slack.sh /var/www/html/current/var/log/system.log $WEBHOOK "main\.ERROR\|main\.CRITICAL" >/dev/null 2>&1 &
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment