Elastic Agent
repository·main·Indexed 42 days ago
https://github.com/elastic/elastic-agentA single, unified agent used to collect data and provide security protection across various environments. It can be managed via Fleet or run in standalone mode. Documentation includes guides for Kubernetes deployment via Helm, including the Kube-stack for OpenTelemetry observability, kube-state-metrics, Elastic AutoOps Agent, and Cloud Defend (Defend for Containers).
What's inside Elastic Agent
- The Elastic Distribution for OpenTelemetry Collector includes a variety of components categorized into Receivers, Exporters, Processors, Extensions, and Connectors. These components allow for the ingestion, transformation, and exportation of telemetry data (logs, metrics, and traces) specifically optimized for Elastic observability stacks.
Overview of the Verifier Receiver
mainThe Verifier Receiver is a custom EDOT (Elastic Distribution of OpenTelemetry) collector component. Its purpose is to verify permissions for integrations based on Identity Federation and report the results as OTEL logs to Elasticsearch.
Key Features:
- Multi-Provider Support: Extensible architecture for AWS, Azure, GCP, and Okta.
- Active & On-demand Verification: Performs actual API calls (using
api_callordry_runmethods) to check if permissions are granted or denied. - Structured Reporting: Outputs OTEL logs containing full policy and integration context, grouped by Identity Federation and policy for easier remediation.
- Permission Registry: Uses an internal mapping to match integration types to required permissions.
Use the built-in OpenTelemetry Collector in Elastic Agent
mainStarting with version 9.5+, Elastic Agent includes a built-in OpenTelemetry (OTel) Collector. This allows you to collect and forward traces, metrics, and logs directly to Elastic Observability using an open-source distribution of the OpenTelemetry Collector.
To begin using this capability, follow the official quickstart guides for your specific environment.
Explore Elastic Agent Helm chart configuration examples
mainThe
eck-integrationsHelm chart provides several pre-configured examples for different deployment scenarios. You can use these examples as templates for your ownvalues.yamlconfiguration.Available configuration patterns include:
Kubernetes Deployments
- Defaults: Standard Kubernetes deployment configuration.
- KSM Autosharding: Configuration optimized for KSM autosharding.
- Only Container Logs: Configured to collect only container logs.
- Hints Autodiscover: Uses Kubernetes hints for autodiscovery.
Fleet Managed Agents
- Managed Agent: Standard Fleet-managed deployment.
- Managed Agent with KSM Autosharding: Fleet-managed deployment optimized for KSM autosharding.
Specialized Integrations & Security
- Nginx: Custom integration setup for Nginx.
- Multiple Integrations: How to configure the agent to run multiple integrations simultaneously.
- Cloud Defend: Standalone deployment for Cloud Defend.
- Custom RBAC: Examples for using user-created ClusterRoles and ServiceAccounts instead of defaults.
System & Other
- System: Example for custom
authlogspaths.
Configure the Kubernetes Autodiscover provider
mainThe Kubernetes provider allows Elastic Agent to automatically discover and monitor Kubernetes resources. It can be used in two modes:
- Standalone Elastic Agent: Configured via the
elastic-agent-standalone-kubernetes.yamlmanifest. Both Conditions-based and Hints-based autodiscover are supported. - Fleet Managed Elastic Agent: Enabled by default with default values. Conditions-based autodiscover is supported, but Hints-based autodiscover is not supported. Configuration follows the Fleet management documentation.
- Standalone Elastic Agent: Configured via the
What is the Elastic APM processor and how does it work?
mainThe Elastic APM processor is an OpenTelemetry Collector component designed to enrich OpenTelemetry trace data with Elastic-specific attributes and metadata. This enrichment ensures that traces are compatible with Elastic APM UIs and features like service maps, transaction groups, and enhanced trace visualization.
Key Concepts
- Relationship with Connector: The processor works in tandem with the Elastic APM connector. While the processor enriches trace data, the connector generates pre-aggregated APM metrics from that trace data.
- Deployment Modes:
- Agent mode: Processes trace data received from OpenTelemetry SDKs before exporting to Elasticsearch.
- Gateway mode: Enriches traces received from other collectors (running in agent mode) before ingestion.
- Replacement for
elastictrace: Theelasticapmprocessor replaces the deprecatedelastictraceprocessor. If upgrading from older versions, you must update your configuration to useelasticapm. - When NOT to use it: If you are using the Managed OTLP (MOTLP) endpoint, you do not need this processor because enrichment happens server-side. Using it with MOTLP can cause conflicts or duplicate processing.
What is the APM Config extension?
mainThe APM Config extension (
apmconfigextension) is an OpenTelemetry Collector component designed for central configuration delivery to EDOT SDKs. It uses the Open Agent Management Protocol (OpAMP) to establish a bidirectional control channel between the Collector and an OpAMP-enabled APM Server endpoint.This allows configuration updates (such as sampling, attribute collection, security settings, and custom SDK options) to be retrieved and delivered dynamically to connected SDKs without requiring application restarts.
Note: This extension is specifically for configuration synchronization; it does not modify telemetry or manage pipelines. It is required when using the Central Configuration feature for EDOT SDKs.
What is the Kubelet stats receiver?
mainThe Kubelet stats receiver is an OpenTelemetry Collector component used within Elastic Agent (and the edot-collector) to collect Kubernetes resource metrics. It queries the Kubelet's
/stats/summaryendpoint to retrieve and convert usage statistics into OpenTelemetry metrics.Metrics collected include:
- Node metrics: CPU, memory, network, and filesystem usage.
- Pod metrics: Resource usage and pod throttling.
- Container metrics: Fine-grained CPU/memory usage and ephemeral storage.
- Volume metrics: Filesystem and storage usage.
What is the Kubernetes objects receiver?
mainThe Kubernetes objects receiver (
k8sobjects) is an OpenTelemetry Collector component used by Elastic Agent to collect Kubernetes API objects (such as pods, namespaces, deployments, and events) and emit them as log signals for Elastic Observability.It supports two collection modes:
pull: Periodically lists Kubernetes objects at fixed intervals.watch: Streams real-time updates from the API server as objects are created, modified, or deleted.
Common use cases include audit tracking, configuration drift detection, and correlating Kubernetes resource changes with application telemetry.
Understand Elasticsearch exporter document routing
mainDocuments are routed to indices or data streams using a hierarchy of modes. The first applicable mode is used:
- Static mode: Routes to
logs_index,metrics_index, ortraces_indexif they are explicitly configured. - Dynamic mode (Index attribute): Uses the
elasticsearch.indexattribute. Precedence: log/metric/span attribute $\rightarrow$ scope attribute $\rightarrow$ resource attribute. - Dynamic mode (Data stream routing): Constructs a data stream name:
${data_stream.type}-${data_stream.dataset}-${data_stream.namespace}.data_stream.typeis static (logs,metrics, ortraces).data_stream.datasetanddata_stream.namespaceare derived from attributes (with precedence: attribute $\rightarrow$ scope $\rightarrow$ resource).- Fallbacks:
dataset$\rightarrow$generic,namespace$\rightarrow$default. - If the scope name matches
/receiver/(\w*receiver), the capture group is used as the dataset.
Note for
otelmapping mode:- For Data Stream routing,
data_stream.datasetalways ends with.otel. - Span events are treated as separate documents and routed as
logs(withdata_stream.type: logs). - The
elasticsearch.indexattribute is removed from the final document.
- Static mode: Routes to
Understand Agent vs. Gateway modes in Elastic Agent
mainThe Elastic Agent (edot-collector) operates in two primary deployment modes depending on your architecture:
- Agent mode: The agent ingests data directly from local infrastructure (logs, metrics) and OpenTelemetry SDKs. It then forwards this data to Elastic or to another collector running in Gateway mode.
- Gateway mode: The agent acts as a central aggregator. It ingests data from multiple collectors running in Agent mode and forwards the aggregated data to Elastic.
How the Gateway Collector pipeline works
mainThe Gateway Collector acts as the central ingestion point. Its configuration depends on your deployment model:
Scenario A: Direct ingestion into Elasticsearch
Used in self-managed or Elastic Cloud (ECH) environments. The Gateway performs central enrichment before exporting data directly to Elasticsearch.
- Enrichment: Uses pipelines for application telemetry and host metrics.
- Routing: Uses a
routingconnector to separate infrastructure metrics from other metrics. Infrastructure metrics are routed to an ECS-based pipeline usingECS-compatibilityexporter mode. Other metrics are exported in OTel-native format to Elasticsearch using theelasticsearchexporter.
Scenario B: Managed OTLP Endpoint
Used when sending data to a managed Elastic OTLP endpoint.
- Workflow: The Gateway receives data via the
OTLPreceiver, processes it through abatchprocessor, and exports it viaOTLPto the managed endpoint. - Benefit: No Elastic-specific enrichment is required within the Kubernetes cluster, as enrichment is handled by the managed endpoint.