Elastic Agent provides a unified way to collect Nginx metrics and logs from your ECS instances and send them to your Elasticsearch cluster for centralized analysis. You can use Fleet to manage agent policies, deploy Elastic Agent to your hosts, and visualize Nginx data through Kibana dashboards.
Create an agent policy
Create an agent policy in Fleet to define how Elastic Agent collects data.
In the Kibana console, go to .
Click Create agent policy.
Enter a name for the policy.
Configure the policy settings as needed.
Expand Advanced Options.
Deselect Collect agent logs and Collect agent metrics.
Click Create agent policy.
Deselecting Collect agent logs and Collect agent metrics reduces unnecessary data collection when you only need Nginx metrics.
Add an Elastic Agent
Install Elastic Agent on your ECS instance and enroll it with Fleet Server.
In the Kibana console, go to .
Click Add Agent.
Select the agent policy you created.
Follow the on-screen instructions for your operating system.
In the Install Fleet Server on a centralized host section, copy the installation command and run it on the first ECS instance. The following example shows a typical installation command. Replace the placeholder values (
xxx) with the values generated in your Fleet setup:
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.5.1-linux-x86_64.tar.gz
tar xzvf elastic-agent-8.5.1-linux-x86_64.tar.gz
cd elastic-agent-8.5.1-linux-x86_64
sudo ./elastic-agent install \
--fleet-server-es=http://es-cn-xxx.elasticsearch.aliyuncs.com:9200 \
--fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2Vydmxxxxxxxxxxxxx \
--fleet-server-policy=e4b6f6b0-1ef9-11ee-xxxView data
After Elastic Agent is installed and enrolled, you can view Nginx data in Kibana through dashboards or the Discover interface.
View Nginx data in dashboards
In the Kibana console, go to Dashboard.
Search for and select [Metrics Nginx] Overview.
The dashboard contains the following three line chart panels: Total requests [Metrics Nginx], Processed requests [Metrics Nginx], and Heartbeat / Up [Metrics Nginx]. You can use the KQL search bar and the Nginx instance filter at the top to filter data.
View index data via Discover
In the Kibana console, go to Discover.
Select the data view, for example
metrics-*, to view the collected Nginx metrics data.