0

I'm using Nginx to reverse proxy a nodejs instance that is currently timing out when an external service attempts to call a specific, secured api endpoint, generating 504 errors.

How can I setup Nginx to notify me (ie. via email) when it serves a 504? Because the api endpoint in question is secured and relies on specific information being passed, a generic monitoring solution won't work.

I'm very surprised I couldn't find any clear information on how to do this after googling for 15 mins.

Thanks.

max
  • 103
  • 1

1 Answers1

4

You don't use Nginx for this. Rather, you use some sort of log processing package to watch the nginx error log for 504s and notify you when it sees one.

Logstash is a very popular and very capable log processing package - it can be easily configured to consume messages out of your error log (using the file input), look for a certain error string (using the grep filter), and then email an alert if it finds a matching line (using the email output).

EEAA
  • 109,363
  • 18
  • 175
  • 245