- Fleet and Elastic Agent Guide: other versions:
- Fleet and Elastic Agent overview
- Beats and Elastic Agent capabilities
- Quick starts
- Migrate from Beats to Elastic Agent
- Deployment models
- Install Elastic Agents
- Install Fleet-managed Elastic Agents
- Install standalone Elastic Agents
- Install Elastic Agents in a containerized environment
- Run Elastic Agent in a container
- Run Elastic Agent on Kubernetes managed by Fleet
- Install Elastic Agent on Kubernetes using Helm
- Example: Install standalone Elastic Agent on Kubernetes using Helm
- Example: Install Fleet-managed Elastic Agent on Kubernetes using Helm
- Advanced Elastic Agent configuration managed by Fleet
- Configuring Kubernetes metadata enrichment on Elastic Agent
- Run Elastic Agent on GKE managed by Fleet
- Run Elastic Agent on Amazon EKS managed by Fleet
- Run Elastic Agent on Azure AKS managed by Fleet
- Run Elastic Agent Standalone on Kubernetes
- Scaling Elastic Agent on Kubernetes
- Using a custom ingest pipeline with the Kubernetes Integration
- Environment variables
- Run Elastic Agent as an OTel Collector
- Run Elastic Agent without administrative privileges
- Install Elastic Agent from an MSI package
- Installation layout
- Air-gapped environments
- Using a proxy server with Elastic Agent and Fleet
- Uninstall Elastic Agents from edge hosts
- Start and stop Elastic Agents on edge hosts
- Elastic Agent configuration encryption
- Secure connections
- Manage Elastic Agents in Fleet
- Configure standalone Elastic Agents
- Create a standalone Elastic Agent policy
- Structure of a config file
- Inputs
- Providers
- Outputs
- SSL/TLS
- Logging
- Feature flags
- Agent download
- Config file examples
- Grant standalone Elastic Agents access to Elasticsearch
- Example: Use standalone Elastic Agent with Elastic Cloud Serverless to monitor nginx
- Example: Use standalone Elastic Agent with Elasticsearch Service to monitor nginx
- Debug standalone Elastic Agents
- Kubernetes autodiscovery with Elastic Agent
- Monitoring
- Reference YAML
- Manage integrations
- Package signatures
- Add an integration to an Elastic Agent policy
- View integration policies
- Edit or delete an integration policy
- Install and uninstall integration assets
- View integration assets
- Set integration-level outputs
- Upgrade an integration
- Managed integrations content
- Best practices for integration assets
- Data streams
- Define processors
- Processor syntax
- add_cloud_metadata
- add_cloudfoundry_metadata
- add_docker_metadata
- add_fields
- add_host_metadata
- add_id
- add_kubernetes_metadata
- add_labels
- add_locale
- add_network_direction
- add_nomad_metadata
- add_observer_metadata
- add_process_metadata
- add_tags
- community_id
- convert
- copy_fields
- decode_base64_field
- decode_cef
- decode_csv_fields
- decode_duration
- decode_json_fields
- decode_xml
- decode_xml_wineventlog
- decompress_gzip_field
- detect_mime_type
- dissect
- dns
- drop_event
- drop_fields
- extract_array
- fingerprint
- include_fields
- move_fields
- parse_aws_vpc_flow_log
- rate_limit
- registered_domain
- rename
- replace
- script
- syslog
- timestamp
- translate_sid
- truncate_fields
- urldecode
- Command reference
- Troubleshoot
- Release notes
Transform an installed Elastic Agent to run as an OTel Collector
editTransform an installed Elastic Agent to run as an OTel Collector
editThis functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
If you have a currently installed standalone Elastic Agent, it can be configured to run as an OTel Collector. This allows you to run Elastic Agent both as a service and in an OTel Collector mode.
In order to configure an installed standalone Elastic Agent to run as an OTel Collector, it’s enough to include a valid OTel Collector configuration in the elastic-agent.yml
file, as shown in the following example.
Example: configure Elastic Agent to ingest host logs and metrics into Elasticsearch using the OTel Collector
editPrerequisites
You’ll need the following:
- A suitable Elasticsearch API key for authenticating on Elasticsearch
- An installed standalone Elastic Agent
-
A valid OTel Collector configuration. In this example we’ll use the OTel sample configuration included in the Elastic Agent repository:
otel_samples/platformlogs_hostmetrics.yml
.
Steps
To change a running standalone Elastic Agent to run as an OTel Collector:
-
Create a directory where the OTel Collector can save its state. In this example we use
<{agent} install directory>/data/otelcol
. -
Open the
<{agent} install directory>/otel_samples/platformlogs_hostmetrics.yml
file for editing. -
Set environment details to be used by OTel Collector:
-
Option 1: Define environment variables for the Elastic Agent service:
-
ELASTIC_ENDPOINT
: The URL of the Elasticsearch instance where data will be sent -
ELASTIC_API_KEY
: The API Key to use to authenticate with Elasticsearch -
STORAGE_DIR
: The directory where the OTel Collector can persist its state
-
-
Option 2: Replace the environment variable references in the sample configuration with the corresponding values:
-
${env:ELASTIC_ENDPOINT}
:The URL of the Elasticsearch instance where data will be sent -
${env:ELASTIC_API_KEY}
: The API Key to use to authenticate with Elasticsearch -
${env:STORAGE_DIR}
: The directory where the OTel Collector can persist its state
-
-
-
Save the opened OTel configuration as
elastic-agent.yml
, overwriting the default configuration of the installed agent. -
Run the
elastic-agent status
command to verify that the new configuration has been correctly applied:elastic-agent status
The OTel Collector running configuration should appear under
elastic-agent
key (note theextensions
andpipeline
keys):┌─ fleet │ └─ status: (STOPPED) Not enrolled into Fleet └─ elastic-agent ├─ status: (HEALTHY) Running ├─ extensions │ ├─ status: StatusOK │ └─ extension:file_storage │ └─ status: StatusOK ├─ pipeline:logs/platformlogs │ ├─ status: StatusOK │ ├─ exporter:elasticsearch/otel │ │ └─ status: StatusOK │ ├─ processor:resourcedetection │ │ └─ status: StatusOK │ └─ receiver:filelog/platformlogs │ └─ status: StatusOK └─ pipeline:metrics/hostmetrics ├─ status: StatusOK ├─ exporter:elasticsearch/ecs │ └─ status: StatusOK ├─ processor:attributes/dataset │ └─ status: StatusOK ├─ processor:elasticinframetrics │ └─ status: StatusOK ├─ processor:resource/process │ └─ status: StatusOK ├─ processor:resourcedetection │ └─ status: StatusOK └─ receiver:hostmetrics/system └─ status: StatusOK
- Congratulations! Host logs and metrics are now being collected and ingested by the Elastic Agent service running an OTel Collector instance. For further details about OpenTelemetry collector components supported by Elastic Agent, refer to the Elastic Distribution for OpenTelemetry Collector README.
On this page