---
id: nginx-opentelemetry
title: Nginx - OpenTelemetry Collector
sidebar_label: Nginx - OTel Collector
description: Learn about the Sumo Logic OpenTelemetry app for Nginx.
slug: /help/docs/integrations/web-servers/opentelemetry/nginx-opentelemetry/
canonical: https://www.sumologic.com/help/docs/integrations/web-servers/opentelemetry/nginx-opentelemetry/
---
import useBaseUrl from '@docusaurus/useBaseUrl';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Nginx is a web server used as a reverse proxy, load balancer, mail proxy, and HTTP cache. The Sumo Logic app for Nginx helps you monitor activity in Nginx. The preconfigured dashboards provide information about site visitors, including the location of visitors, devices/operating systems, and browsers used, and information about server activity, including bots, observed, and error information.
The app has been tested with Nginx version:
- `1.19.8`
- `1.21.4`
- `1.23.1`
We use the OpenTelemetry collector for Nginx metric collection and for collecting Nginx logs.
The diagram below illustrates the components of the Nginx collection for each web server.
OpenTelemetry collector runs on the same host as Nginx, and uses the [Nginx Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/nginxreceiver) to obtain Nginx metrics, and the [Sumo Logic OpenTelemetry Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter) to send the metrics to Sumo Logic. Nginx logs are sent to Sumo Logic through a [filelog receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver).
:::info
This app includes [built-in monitors](#nginx-alerts). For details on creating custom monitors, refer to [Create monitors for Nginx app](#create-monitors-for-nginx-app).
:::
## Log and metrics types
The Sumo Logic app for Nginx assumes:
- Nginx app supports the default access logs and error logs format.
- For a list of metrics that are collected and used by the app, see [Nginx Metrics](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/nginxreceiver/documentation.md).
## Fields Creation in Sumo Logic for Nginx
Following are the [Fields](/docs/manage/fields/) which will be created as part of Nginx app installation, if not already present.
- `webengine.cluster.name`. User configured.Enter a name to uniquely identify your Nginx web server cluster. This cluster name will be shown in the Sumo Logic dashboards.
- `webengine.node.name`. Has value of host name.
- `webengine.system`. Has fixed value of `nginx`.
- `sumo.datasource`. Has fixed value of `nginx`.
## Prerequisites
### For metrics collection
- This collection fetches stats from a Nginx Web Server instance using the `/status` endpoint. The app has been tested with Nginx versions 1.19.8, 1.21.4, and 1.23.1.
- You must configure NGINX to expose status information by editing the NGINX configuration. Refer to [ngx_http_stub_status_module](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) guide to configure the NGINX stats module ngx_http_stub_status_module.
### For logs collection
* Configure your Nginx server to expose status endpoint for collecting metrics: The receiver used gets stats from an Nginx Web Server instance using the status endpoint. In order to receive server statistics, you must configure the server's nginx.conf file to [enable status support](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/nginxreceiver#configuration).
* Configure and retrieve access and error log files: Before you can configure Sumo Logic to ingest logs, you must configure the logging of errors and processed requests in NGINX Open Source and NGINX Plus. For instructions, refer to the following [documentation](https://docs.nginx.com/nginx/admin-guide/monitoring/logging/).
import LogsCollectionPrereqisites from '../../../reuse/apps/logs-collection-prereqisites.md';
For Windows systems, log files which are collected should be accessible by the SYSTEM group. Use the following set of PowerShell commands if the SYSTEM group does not have access.
```
$NewAcl = Get-Acl -Path ""
# Set properties
$identity = "NT AUTHORITY\SYSTEM"
$fileSystemRights = "ReadAndExecute"
$type = "Allow"
# Create new rule
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
# Apply new rule
$NewAcl.SetAccessRule($fileSystemAccessRule)
Set-Acl -Path "" -AclObject $NewAcl
```
## Collection configuration and app installation
Follow these steps to set up and deploy the source template to collect data in Sumo Logic from a remotely managed OpenTelemetry collector.
### Step 1: Set up remotely managed OpenTelemetry collector
import OtelCollectorInstallation from '../../../reuse/apps/opentelemetry/otel-collector-installation.md';
:::note
If you want to configure your source locally, you can do so by downloading the YAML file. For details, see [Configure OpenTelemetry collectors locally](/docs/integrations/sumo-apps/opentelemetry-collector-insights/#configure-opentelemetry-collectors-locally).
:::
### Step 2: Configure the source template
import NginxConfigureSourceTemplate from '../../../reuse/send-data/nginx-configure-source-template.md';
import TimestampParsing from '../../../reuse/apps/opentelemetry/timestamp-parsing.md';
import ProcessingRules from '../../../reuse/opentelemetry/processing-rules.md';
### Step 3: Push the source template to the desired remotely managed collectors
import DataConfiguration from '../../../reuse/apps/opentelemetry/data-configuration.md';
## Viewing the Nginx dashboards
All dashboards have a set of filters that you can apply to the entire dashboard. Use these filters to drill down and examine the data to a granular level.
- You can change the time range for a dashboard or panel by selecting a predefined interval from a drop-down list, choosing a recently used time range, or specifying custom dates and times. [Learn more](/docs/dashboards/set-custom-time-ranges/).
- You can use template variables to drill down and examine the data on a granular level. For more information, see [Filtering Dashboards with Template Variables](/docs/dashboards/filter-template-variables/).
### Overview
The **Nginx - Overview** dashboard provides an at-a-glance view of the NGINX server access locations, error logs along with connection metrics.
Use this dashboard to:
- Gain insights into originated traffic location by region. This can help you allocate computer resources to different regions according to their needs.
- Gain insights into your Nginx health using Critical Errors and Status of Nginx Server.
- Get insights into Active and dropped connection.
### Error Logs
The **Nginx - Error Logs** Analysis dashboard provides a high-level view of log level breakdowns, comparisons, and trends. The panels also show the geographic locations of clients and clients with critical messages, new connections and outliers, client requests, request trends, and request outliers.
Use this dashboard to:
- Track requests from clients. A request is a message asking for a resource, such as a page or an image.
- Track and view client geographic locations generating errors.
- Track critical alerts and emergency error alerts.
### Trends
The **Nginx - Trends** dashboard provides a high-level view of the activity and health of Nginx servers on your network. Dashboard panels display visual graphs and detailed information on traffic volume and distribution, responses over time, as well as time comparisons for visitor locations and server hits.
Use this dashboard to:
- Understand the traffic distribution across servers, provide insights for resource planning by analyzing data volume and bytes served.
- Gain insights into originated traffic location by region. This can help you allocate compute resources to different regions according to their needs.
### Outlier Analysis
The **Nginx - Outlier Analysis** dashboard provides a high-level view of Nginx server outlier metrics for bytes served, number of visitors, and server errors. You can select the time interval over which outliers are aggregated, then hover the cursor over the graph to display detailed information for that point in time.
Use this dashboard to:
- Detect outliers in your infrastructure with Sumo Logic's machine learning algorithm.
- Identify outliers in incoming traffic and the number of errors encountered by your servers.
You can use schedule searches to send alerts to yourself whenever there is an outlier detected by Sumo Logic.
### Threat Intel
The **Nginx - Threat Intel** dashboard provides an at-a-glance view of threats to Nginx servers on your network. Dashboard panels display the threat count over a selected time period, geographic locations where threats occurred, source breakdown, actors responsible for threats, severity, and a correlation of IP addresses, method, and status code of threats. Use this dashboard to gain insights and understand threats in incoming traffic and discover potential IOCs. Incoming traffic requests are analyzed using Sumo Logic [threat intelligence](/docs/security/threat-intelligence/).
### Web Server Operations
The **Nginx - Web Server Operations** dashboard provides a high-level view combined with detailed information on the top ten bots, geographic locations, and data for clients with high error rates, server errors over time, and non 200 response code status codes. Dashboard panels also show information on server error logs, error log levels, error responses by a server, and the top URIs responsible for 404 responses.
Use this dashboard to:
- Gain insights into Client, Server Responses on Nginx Server. This helps you identify errors in Nginx Server.
- Identify geo-locations of all Client errors. This helps you identify client location causing errors and helps you to block client IPs.
### Visitor Access Types
The **Nginx - Visitor Access Types** dashboard provides insights into visitor platform types, browsers, and operating systems, as well as the most popular mobile devices, PC and Mac versions used.
Use this dashboard to:
- Understand which platform and browsers are used to gain access to your infrastructure.
- These insights can be useful for planning in which browsers, platforms, and operating systems (OS) should be supported by different software services.
### Visitor Locations
The **Nginx - Visitor Locations** dashboard provides a high-level view of Nginx visitor geographic locations both worldwide and in the United States. Dashboard panels also show graphic trends for visits by country over time and visits by US region over time. Use this dashboard to gain insights into geographic locations of your user base. This is useful for resource planning in different regions across the globe.
### Visitor Traffic Insight
The **Nginx - Visitor Traffic Insight** dashboard provides detailed information on the top documents accessed, top referrers, top search terms from popular search engines, and the media types served.
Use this dashboard to:
- Understand the type of content that is frequently requested by users.
- It helps in allocating IT resources according to the content types.
### Connections and Requests Metrics
The **Nginx - Connections and Requests Metrics** dashboard provides insight into active, dropped connections, reading, writing, and waiting requests.
Use this dashboard to:
- Gain information about active and dropped connections. This helps you identify the connection rejected by Nginx Server.
- Gain information about the total requests handled by Nginx Server per second. This helps you understand read, write requests on Nginx Server.
## Create monitors for Nginx app
import CreateMonitors from '../../../reuse/apps/create-monitors.md';
### Nginx alerts
| Alert Name | Alert Description and conditions | Alert Condition | Recover Condition |
|:--|:--|:--|:--|
| `Nginx - Access from Highly Malicious Sources Alert` | This alert gets triggered when an Nginx server is accessed from highly malicious IP addresses. | Count > = 1 | Count < 1 |
| `Nginx - Critical Error Messages Alert` | This alert gets triggered when we detect critical error messages for a given Nginx server. | Count > = 1 | Count < 1 |
| `Nginx - High Client (HTTP 4xx) Error Rate Alert` | This alert gets triggered when there are too many HTTP requests (>5%) with a response status of 4xx. | Count > = 1 | Count < 1 |
| `Nginx - High Number of Active Connections Alert` | This alert gets triggered when there are many number of active connections. | Count > = 100 | Count < 100 |
| `Nginx - High Server (HTTP 5xx) Error Rate Alert` | This alert gets triggered when there are too many HTTP requests (>5%) with a response status of 5xx. | Count > = 1 | Count < 1 |