Documentation Center
AlienVault® USM Anywhere™

NGINX

When you configure NGINX integration to send log data to USM Anywhere, you can use the Nginx plugin (Access Log) or Nignx Error plugin (Error Log) to translate the raw log data into normalized events for analysis.

Device Details
Device vendor NGINX
Device type Web server
Connection type syslog
Vendor link https://www.nginx.com/resources/admin-guide/logging-and-monitoring/

Integrating NGINX

Before you configure the integration, you must have the IP Address of the USM Anywhere Sensor.

To configure NGINX to send log data over syslog to USM Anywhere

  1. Open /etc/nginx/nginx.conf.

  2. To send access logs,

    • Update the log_format, as shown:

      log_format compression '$remote_addr - $remote_user [$time_local] '

      '"$request" $status $body_bytes_sent '

      '"$http_referer" "$http_user_agent" ';

    • Edit the logging directives access_log, as shown:

      access_log syslog:server=<USM_Anywhere_IP>:514,tag=nginx,severity=info

      Where severity can equal any of the following values, in increasing severity:

      debug, info, notice, warn, error(default), crit, alert, emerg

      Messages are logged at the selected level and all levels above that, if any.

  3. To send error logs,

    • Edit the logging directives error_log, as shown:

      error_log syslog:server=<USM_Anywhere_IP>:514,tag=nginx_error,severity=warn

      Where severity can equal any of the following values, in increasing severity:

      debug, info, notice, warn, error(default), crit, alert, emerg

      Messages are logged at the selected level and all levels above that, if any.

Plugin Enablement

The Nginx plugin automatically processes all messages that have the syslog tag nginx.

The Nginx Error plugin automatically processes all messages that have the syslog tag nginx_error.

Available Plugin Fields

The following plugin fields are important attributes extracted from the syslog message. The USM Anywhere reports use these fields, and you can also reference them when creating custom reports. In addition to reporting, the USM Anywhere correlation rules make use of these fields.

Nginx

  • timestamp_occured
  • bytes_out
  • response_code
  • request_url
  • time_zone
  • request_method
  • application_protocol
  • source_address
  • event_name
  • event_description
  • request_referrer
  • request_user_agent

Nginx Error

  • application_protocol
  • customfield_0
  • customfield_1
  • customheader_0
  • customheader_1
  • destination_address
  • destination_hostname
  • destination_port
  • event_description
  • event_name
  • event_severity
  • external_id
  • file_path
  • rep_device_address
  • rep_device_hostname
  • request_method
  • request_referrer
  • request_url
  • source_address
  • source_hostname
  • source_process_id
  • timestamp_occured

Troubleshooting

For troubleshooting, refer to the vendor documentation:

https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/