Skip to main content
Version: NG-2.14

Nginx

Introduction

Nginx (pronounced engine-x) is a popular open-source web server, reverse proxy server, and load balancer. It is well-known for its performance, scalability, and versatility.

Getting Started

Compatibility

The Nginx O11ySource is compatible with all versions greater than 1.25.3

Data Collection Method

vuSmartMaps collects health and performance data from Nginx server using an internal data collector. This data collector collects data based on the source configuration. Nginx logs are collected by VuNet's Logbeat agent

Prerequisites

Inputs for Configuring Data Source

  • Nginx Server: The IP Address/FQDN of the Nginx server. This field is the key to identify each server you add here.
  • Period [in seconds]: How frequently data is gathered. The period should be between 60 seconds – 3000 seconds.
  • URL: The server URL to Nginx server-status page. Eg: http://127.0.0.1, https://127.0.0.1, http://127.0.0.1:8080 or https://127.0.0.1:8080
  • Access Log Path: Enter the Nginx access logfile's entire path
  • Error Log Path: Enter the Nginx error logfile's entire path.

Firewall Requirement

To collect data from this O11ySource, ensure the following ports are opened:

Source IPDestination IPDestination PortProtocolDirection
IP address of the Nginx serverData Collector End Point9092*TCPInbound

*Before providing the firewall requirements, please update the port based on the customer environment.

Configuring the Target

Configure Metrics Collection from Nginx Server VuNet's internal data collectors collects Nginx metrics by connecting to the stub_status module, which provides the necessary functionality to display the status page. This module makes it simple to determine how well the server is doing.

  • To check whether the stub_status module is enabled or not, use nginx -V 2\>&1 | grep -o "with-http_stub_status_module". If you see a grep match output containing http_stub_status_module, then your module is already enabled and you can skip ahead.
  • If the status module is not enabled, you should check your Nginx configuration file located by default at /etc/nginx/nginx.conf or /etc/nginx/sites-available/default for most systems, or within a specific virtual host file
  • As seen below, you must enable the status module and make sure that stub_status is active in order to gather metrics from Nginx. If you are using a prebuilt Nginx package, it should usually be included by default. To confirm, check if the stub_status on; line is present in your Nginx configuration. To indicate which IP addresses should view the status page, you must alter the block that begins with location /server_status. In the example that follows, 127.0.0.1 access is permitted.
location /server_status {


stub_status;


allow 127.0.0.1;


deny all;


stub_status on;


server_tokens on;


}

Configure Logs Collection from Nginx Server The Nginx access log and error log offers even more specific information about each client request for Nginx Open Source version than the status module does. Your Nginx logs can be customized to include information that is more pertinent to your requirements. Nginx logs are collected by VuNet's Logbeat agent.

  • Access log from Nginx server are collected in a specific format. Inculde the below format in your Nginx configuration.
log_format access_format 'time: $time_iso8601,' ' bytes_sent: $bytes_sent,' ' connection_time: $connection_time,' ' nginx_host: $host,' ' pid: $pid,' ' proxy_host: $proxy_host,' ' proxy_port: $proxy_port,' ' realip_remote_addr: $realip_remote_addr,' ' realip_remote_port: $realip_remote_port,' ' remote_addr: $remote_addr,' ' remote_port: $remote_port,' ' request: $request,' ' request_filename: $request_filename,' ' request_method: $request_method,' ' request_time: $request_time,' ' request_uri: $request_uri,' ' server_addr: $server_addr,' ' server_name: $server_name,' ' server_port: $server_port,' ' server_protocol: $server_protocol,' ' ssl_client_verify: $ssl_client_verify,' ' ssl_protocol: $ssl_protocol,' ' ssl_server_name: $ssl_server_name,' ' ssl_session_id: $ssl_session_id,' ' ssl_session_reused: $ssl_session_reused,' ' status: $status,' ' upstream_addr: $upstream_addr,' ' upstream_bytes_received: $upstream_bytes_received,' ' upstream_bytes_sent: $upstream_bytes_sent,' ' upstream_cache_status: $upstream_cache_status,' ' upstream_connect_time: $upstream_connect_time,' ' upstream_response_time: $upstream_response_time';




access_log <Path of Log File> access_format;

Configuration Steps

  • Enable the O11ySource.
  • Select the Sources tab and press the + button to add a new Nginx host to be monitored.
  • Set up metrics and log collection configurations. Afterwards, select Save and Continue to proceed with downloading the Logbeat agent.
  • The following packages will be available for download based on the OS:Download <OS> Logbeat Installation Binary - Downloads the full Logbeat package with required configurations for a fresh installationDownload <OS> Logbeat Update Configuration Binary - Downloads the agent configuration package to update an existing Logbeat installation
  • Download the agent installation or update package, then click Finish to close the data source window.

Metrics Collected

NameDescriptionData Type
@timestampThe original timestamp as a string, often representing the time the data was recorded or received.String
timestampThe precise timestamp of the event, with microsecond precision.DateTime64
hostThe hostname or IP address of the machine where the event originated.String
tenant_idThe unique identifier for the tenant (user or customer) associated with this event.UInt64
bu_idThe unique identifier for the business unit associated with this event.UInt64
serverThe name or identifier of the server handling the requests.String
src_hostThe source host from which the request originated.String
src_instanceThe source instance or specific instance of the application sending the request.String
nameThe name associated with this particular set of metrics, often the service or application name.String
portThe port number on which the server is listening for incoming requests.UInt64
requestsThe total number of requests received by the server or application.UInt64
acceptsThe number of accepted connections.UInt64
handledThe number of successfully handled connections or requests.UInt64
readingThe number of connections where the server is currently reading the request.UInt64
writingThe number of connections where the server is currently writing a response.UInt64
waitingThe number of connections that are currently idle, waiting for a request.UInt64
activeThe number of active connections at the time of measurement.Float64
droppedThe number of connections that were dropped or refused.Float64
requests_diffThe difference in the number of requests since the last measurement period.Float64
accepts_diffThe difference in the number of accepted connections since the last measurement period.Float64
handled_diffThe difference in the number of handled connections since the last measurement period.Float64
dropped_diffThe difference in the number of dropped connections since the last measurement period.Float64
requests_rateThe rate of requests per second.Float64
periodThe duration of the measurement period, typically in seconds.Float64
accepts_rateThe rate of accepted connections per second.Float64
handled_rateThe rate of handled connections per second.Float64
dropped_rateThe rate of dropped connections per second.Float64
telegraf_unique_idA unique identifier for the metrics record, often generated by the Telegraf agent collecting the data.String
nginx_hostThe hostname or IP address of the NGINX server that is handling the requests.String
timestampThe precise timestamp of the event, with microsecond precision.DateTime64
messageThe log message content.String
beatThe name or identifier of the Beat (e.g., Filebeat, Metricbeat) that collected the log.String
bu_idThe unique identifier for the business unit associated with this event.UInt64
bytes_sentThe total number of bytes sent in the request/response.UInt64
server_addrThe IP address of the server that processed the request.String
targetThe target endpoint or resource being requested.String
beat_hostnameThe hostname of the machine where the Beat is running.String
connections_activeThe number of active connections at the time of the log entry.UInt64
connections_readingThe number of connections currently reading requests.UInt64
connection_requestsThe number of connection requests.UInt64
connections_waitingThe number of connections currently idle, waiting for a request.UInt64
connections_writingThe number of connections currently writing a response.UInt64
content_lengthThe length of the content in the request/response.UInt64
hostThe hostname of the server processing the request.String
log_file_pathThe file path of the log file where this entry is recorded.String
source_idA unique identifier for the source of the log entry.String
topic_nameThe name of the topic, if logs are being collected and organized by topic (e.g., in Kafka).String
http_responseThe HTTP response code returned by the server.String
limit_rateThe rate limit applied to the request, if any.UInt64
msecThe time in milliseconds at which the event occurred.Float64
nginx_hostThe hostname of the NGINX server that processed the request.String
nginx_portThe port on which the NGINX server is listening.UInt64
pidThe process ID of the NGINX process handling the request.String
proxy_hostThe hostname of the proxy server, if the request passed through one.String
proxy_portThe port of the proxy server.String
realip_remote_portThe real IP address's remote port from where the request originated.Float64
remote_addrThe IP address of the client making the request.String
realip_remote_addrThe actual remote IP address, especially useful if behind a proxy.String
remote_portThe remote port from which the request was made.String
client_ipThe IP address of the client, potentially different from remote_addr if the request passed through a proxy.String
connectionThe connection details or ID associated with the request.String
error_messageThe error message, if any occurred during processing.String
log_levelThe severity level of the log (e.g., INFO, ERROR, WARN).String
upstream_urlThe URL of the upstream server or service that handled the request.String
tidThe thread ID of the process handling the request.String
requestThe full HTTP request line sent by the client.String
request_methodThe HTTP method used in the request (e.g., GET, POST).String
request_uriThe URI or path requested by the client.String
request_lengthThe length of the request in bytes.UInt64
request_timeThe time taken to process the request, in seconds.Float64
request_filenameThe name of the file or resource requested, if applicable.String
server_nameThe name of the server handling the request.String
server_portThe port number on which the server is listening.String
server_protocolThe protocol used by the server (e.g., HTTP/1.1, HTTP/2).String
ssl_session_idThe SSL session ID, if the request used SSL/TLS.String
ssl_server_nameThe server name indicated by the client during SSL handshake.String
ssl_protocolThe SSL/TLS protocol used for the connection.String
o11ysource_nameThe name of the observability source, if part of a broader observability platform.String
ssl_client_verifyThe result of SSL client certificate verification.String
ssl_session_reusedWhether the SSL session was reused (e.g., YES or NO).String
statusThe HTTP status code returned by the server (e.g., 200, 404).UInt64
tenant_idThe unique identifier for the tenant (user or customer) associated with this event.UInt64
typeThe type of event or log entry.String
upstream_addrThe IP address of the upstream server that handled the request.String
upstream_connect_timeThe time taken to establish a connection to the upstream server.Float64
upstream_response_timeThe time taken by the upstream server to respond.Float64
upstream_bytes_sentThe number of bytes sent to the upstream server.UInt64
upstream_bytes_receivedThe number of bytes received from the upstream server.UInt64
upstream_header_timeThe time taken to receive the response headers from the upstream server.Float64
upstream_response_lengthThe length of the response received from the upstream server.UInt64
upstream_cache_statusThe cache status of the response from the upstream server (e.g., HIT, MISS).String