Support & Documentation
Follow

Configure for Nginx

The Stackify Monitoring Agent can monitor the health of your web application, including Requests/min vs Average Page Load time, HTTP Request Error Rate, and Apdex Satisfaction Score.

To enable Stackify to monitor your Nginx web application from the Monitoring Agent, there are a couple of things to make sure of.

Configuring Access Logs and Log Formats

The Stackify Monitoring Agent needs the following information to be present in access logs:

  • time taken
  • request path
  • response status
  • log event date

You can configure what is written to access logs using log_format directive. This directive supports multiple Nginx variables available at the time of a log write.

You need to make sure the following variables for log format are used:

  • time taken: $request_time
  • request path: $request or $request_uri
  • response status: $status
  • log event date: $time_local or $time_iso8601 or $msec

NOTE: If log format is omitted for access_log directive, the default log format will be used. The default log format does not contain all the required fields, so the monitoring agent will not be able to obtain information.

NOTE: Nginx allows you to configure multiple access logs for one application. They all will be processed.

NOTE: Nginx also allows you to disable access logs for an application, but enable access logs for particular locations or cases. The monitoring agent will only obtain data from the available logs, so this will not be a real statistic for the whole application.

Configuration Example

http {
    log_format stackify '$remote_addr $msec "$request" $request_time $status "$http_user_agent"';
    server {
        …
        access_log /var/log/nginx/application_access_log.log stackify;
    }
}

Check Permissions

The final step is to ensure that the log file and directory are accessible by the monitoring agent.

  • chmod 755 on the log file directories
  • chmod 744 or similar on the log files

NOTE: If you use something like logrotate, be sure to specify the permissions (mode) of the new log file that is created after rotating the old log file out and replacing it.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk