Nginx
The Nginx source collects metrics from the NGINX stub_status HTTP endpoint, parses access and error log files, and receives OTLP traces exported by the NGINX OpenTelemetry module. Choose any combination of Logs, Metrics, and Traces with the telemetry type selector.
Supported Telemetry Types
Linux
✓
✓
✓
Windows
✓
✓
✓
macOS
✓
✓
✓
Prerequisites
Metrics: NGINX must be built with
ngx_http_stub_status_module(the--with-http_stub_status_modulebuild option, not enabled by default) and expose a reachable status endpoint via astub_statuslocation. The default endpoint ishttp://localhost:80/status. The collector host must be able to reach that endpoint. See Module ngx_http_stub_status_module.Logs: NGINX must be writing access and error logs, and the collector must run where it can read those files (or have them shipped to it). Default paths are
/var/log/nginx/access.log*and/var/log/nginx/error.log*. The configured Log Format must match the on-disk format. See Module ngx_http_log_module.Traces: The NGINX OpenTelemetry module must be configured to export OTLP/gRPC trace data to the host and port this source listens on (default
0.0.0.0:4317).
Configuration

General
Choose Telemetry Type
Telemetry Selector
No
["Logs", "Metrics"]
Which signals this source collects: Logs, Metrics, Traces.
Logs
Relevant when Choose Telemetry Type includes Logs.
Data Flow
Enum: high, low
No
high
Enable high flow or reduced low flow.
Access Log Paths
Strings
No
/var/log/nginx/access.log*
Path to NGINX access log file(s).
Error Log Paths
Strings
No
/var/log/nginx/error.log*
Path to NGINX error log file(s).
Metrics
Relevant when Choose Telemetry Type includes Metrics.
Endpoint
String
Yes
http://localhost:80/status
The endpoint of the NGINX server stub_status location.
Traces
Relevant when Choose Telemetry Type includes Traces.
OTLP GRPC Port
Integer
No
4317
TCP port to receive OTLP trace data using the gRPC protocol. Configure the NGINX otel module to export to this port. Valid range 1-65535.
Advanced
Log Format
Enum: default, observiq
No
default
Log parsing format. Relevant when collecting Logs.
Start At
Enum: beginning, end
No
end
Start reading logs from beginning or end. Relevant when collecting Logs.
Parse
Boolean
No
true
Parses the log fields into structured data. Relevant when collecting Logs.
Filtering
Metrics
No
(all enabled)
Select which NGINX metrics to collect. All metrics are enabled by default; toggle individual metrics off as needed. See NGINX Metrics below. Relevant when collecting Metrics.
Enable TLS
Boolean
No
false
Whether or not to use TLS for the metrics endpoint. Relevant when collecting Metrics.
Skip TLS Certificate Verification
Boolean
No
false
Enable to skip TLS certificate verification. Relevant when Enable TLS is true.
TLS Certificate Authority File
String
No
(empty)
Certificate authority used to validate TLS certificates. Relevant when Enable TLS is true.
TLS Client Certificate File
String
No
(empty)
A TLS certificate used for client authentication, if mutual TLS is enabled. Relevant when Enable TLS is true.
TLS Client Private Key File
String
No
(empty)
A TLS private key used for client authentication, if mutual TLS is enabled. Relevant when Enable TLS is true.
Collection Interval
Integer
No
60
How often (seconds) to scrape for metrics. Relevant when collecting Metrics.
OTLP GRPC Listen Address
String
No
0.0.0.0
The IP address to listen on for OTLP gRPC trace data from the NGINX otel module. Relevant when collecting Traces.
Enable TLS (Traces)
Boolean
No
false
Whether or not to use TLS for the OTLP gRPC listener. Relevant when collecting Traces.
Server Certificate File
String
Yes
(empty)
A path to the server certificate to be used for TLS. Relevant when the Traces Enable TLS is true.
Server Private Key
String
Yes
(empty)
A path to the server private key to be used for TLS. Relevant when the Traces Enable TLS is true.
Mutual TLS
Boolean
No
false
Whether or not to require client TLS authentication (mTLS). Relevant when the Traces Enable TLS is true.
TLS Certificate Authority File (Traces)
String
Yes
(empty)
A path to the certificate authority to use for authenticating client certificates. Relevant when the Traces Enable TLS and Mutual TLS are both true.
NGINX Metrics
The Filtering parameter toggles these metrics individually. Defaults reflect the upstream Nginx Receiver (v0.153.0).
nginx.connections_accepted
connections
Enabled
The total number of accepted client connections.
nginx.connections_current
connections
Enabled
The current number of nginx connections by state.
nginx.connections_handled
connections
Enabled
The total number of handled connections.1
nginx.requests
requests
Enabled
Total number of requests made to the server since it started.
Generally the same as
nginx.connections_acceptedunless a resource limit (for example, theworker_connectionslimit) has been reached.
Examples
Collect metrics and logs from a local NGINX server
Scrape the stub_status endpoint every 30 seconds and tail the default access and error logs.
Configuration Tips
For metrics, point Endpoint at the
stub_statuslocation you configured in NGINX (for examplehttp://localhost:80/status), not the site root.Use the Filtering parameter to disable individual NGINX metrics you do not need rather than collecting all of them.
For traces, set OTLP GRPC Port and Listen Address to match what the NGINX otel module is configured to export to, and open that port between NGINX and the collector.
Troubleshooting
No metrics appear
Symptoms: the source is running but reports no NGINX metrics.
Solutions:
Confirm NGINX was built with
ngx_http_stub_status_moduleand that astub_statuslocation is enabled and reachable at the configured Endpoint.Verify the collector host can reach the Endpoint (try
curl http://localhost:80/statusfrom the collector host).If TLS is enabled, confirm the certificate paths are correct, or enable Skip TLS Certificate Verification for testing.
Connection refused on the metrics endpoint
Symptoms: the collector logs connection-refused errors scraping the status endpoint.
Solutions:
Confirm NGINX is listening on the host and port in the Endpoint and that the
stub_statuslocation is not restricted byallow/denyrules blocking the collector host.Check for a firewall blocking the path between the collector and NGINX.
No logs appear
Symptoms: no log records reach the pipeline.
Solutions:
Verify the Access Log Paths and Error Log Paths match where NGINX actually writes logs.
Confirm the collector user has read permission on those files.
Ensure the Log Format matches the on-disk format; if
parsefails, set Log Format correctly or disable Parse.
Standalone Source
Related Resources
Last updated
Was this helpful?