|
| 1 | +# Hybrid Agent and Beats Receivers |
| 2 | + |
| 3 | +This page provides a brief overview of the Beat receivers and Hybrid Agent projects and how to experiment with them. |
| 4 | +These are part of Elastic's larger effort to base data collection on OpenTelemetry technologies. For more context, see |
| 5 | +https://www.elastic.co/observability-labs/blog/elastic-agent-pivot-opentelemetry. This document does not aim to be a |
| 6 | +comprehensive explanation of beat receivers or hybrid agent as concepts, it is only a brief overview along with |
| 7 | +testing instructions. Beat receivers and hybrid agent capabilities are available starting with the 9.1.0 and 8.19.0 |
| 8 | +releases at a technical preview level and are not enabled or used by default. |
| 9 | + |
| 10 | +## Beat Receivers |
| 11 | + |
| 12 | +**Beat Receivers** are beat inputs and processors executing as a receiver in an OpenTelemetry collector pipeline. |
| 13 | +Beat receivers are designed to output the exact same data they do today, and do not output data in the OTLP schema. |
| 14 | + |
| 15 | +Beat receivers will eventually be the default execution mode for Beat inputs in an elastic-agent.yml file (whether |
| 16 | +written by hand or generated via Fleet). Elastic Agent will automatically translate the relevant parts of it's |
| 17 | +elastic-agent.yml file into OpenTelemetry collector configurations and execute them in the collector. This capability |
| 18 | +is currently gated by a feature flag. |
| 19 | + |
| 20 | +### Beat Receivers for Agent Monitoring |
| 21 | + |
| 22 | +The first part of the Elastic Agent configuration that will run as Beat receivers |
| 23 | +by default will be the self-monitoring functionality. To use Beat receivers for self-monitoring set the |
| 24 | +`_runtime_experimental: "otel"` feature flag in the `agent.monitoring` section of the configuration: |
| 25 | + |
| 26 | +```yaml |
| 27 | +agent.monitoring: |
| 28 | + enabled: true |
| 29 | + logs: true |
| 30 | + metrics: true |
| 31 | + _runtime_experimental: otel |
| 32 | +``` |
| 33 | +
|
| 34 | +This setting will be available as a toggle in the Fleet UI as part of the agent policy advanced settings once |
| 35 | +https://github.com/elastic/kibana/issues/233186 is implemented. Before that change is implemented, the agent policy |
| 36 | +overrides API can be used to add `_runtime_experimental: "otel"` to the `agent.monitoring` section of the policy. |
| 37 | +See https://support.elastic.dev/knowledge/view/06b69893 for details on the policy overrides API. |
| 38 | + |
| 39 | +Executing the `elastic-agent diagnostics` command in this mode will now produce an `otel-final.yml` file showing the generated |
| 40 | +collector configuration used to run the Beat receivers. |
| 41 | + |
| 42 | +### Beat Receivers for Data Collection |
| 43 | + |
| 44 | +The capability to use Beat receivers is being enabled on per Beat and per input type basis. At the time of writing (August 2025), |
| 45 | +Filebeat and Metricbeat can run as receivers and both the `filestream` and `system/metrics` inputs work outside of |
| 46 | +monitoring use cases. An example showing how to set the feature flag to run the `filestream` and `system/metrics` inputs as Beat |
| 47 | +receivers follows below. |
| 48 | + |
| 49 | +```yaml |
| 50 | +inputs: |
| 51 | + - id: system-metrics-receiver |
| 52 | + type: system/metrics |
| 53 | + _runtime_experimental: otel |
| 54 | + streams: |
| 55 | + - metricsets: |
| 56 | + - cpu |
| 57 | + data_stream.dataset: system.cpu |
| 58 | + - id: filestream-receiver |
| 59 | + type: filestream |
| 60 | + _runtime_experimental: otel |
| 61 | + data_stream.dataset: generic |
| 62 | + paths: |
| 63 | + - /var/log/*.log |
| 64 | +outputs: |
| 65 | + default: |
| 66 | + type: elasticsearch |
| 67 | + hosts: [http://localhost:9200] |
| 68 | + api_key: placeholder |
| 69 | +``` |
| 70 | + |
| 71 | +## Hybrid Agent |
| 72 | + |
| 73 | +**Hybrid Agent** refers the capability of Elastic Agent to run OpenTelemetry collector pipelines specified directly in |
| 74 | +it's elastic-agent.yml file. This allows running Beat based ECS data collection alongside OTLP native data collection in |
| 75 | +the same agent. The diagram below shows the end state of the Elastic Agent where both Beats (via Beat receivers) and OpenTelemetry |
| 76 | +collector receivers run in the same collector process. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +A runnable Hybrid agent example configuration follows below. |
| 81 | + |
| 82 | +```yaml |
| 83 | +agent.monitoring: |
| 84 | + enabled: true |
| 85 | + logs: true |
| 86 | + metrics: true |
| 87 | +
|
| 88 | +outputs: |
| 89 | + default: |
| 90 | + type: elasticsearch |
| 91 | + hosts: [127.0.0.1:9200] |
| 92 | + api_key: "example-key" |
| 93 | + preset: balanced |
| 94 | +
|
| 95 | +inputs: |
| 96 | + - id: filestream-system-66cab0a6-6fa3-46b1-9af1-2ea171fbd887 |
| 97 | + type: filestream |
| 98 | + # _runtime_experimental: otel # Optional - also run the filestream input as a collector receiver. |
| 99 | + data_stream: |
| 100 | + namespace: default |
| 101 | + streams: |
| 102 | + - id: filestream-system.auth-66cab0a6-6fa3-46b1-9af1-2ea171fbd887 |
| 103 | + data_stream: |
| 104 | + dataset: system.auth |
| 105 | + paths: |
| 106 | + - /var/log/auth*.log |
| 107 | +
|
| 108 | +receivers: |
| 109 | + httpcheck/httpcheck-6d24bb0d-5349-4714-a7ea-2988abcb928b: |
| 110 | + collection_interval: 30s |
| 111 | + targets: |
| 112 | + - method: "GET" |
| 113 | + endpoints: |
| 114 | + - https://example.com |
| 115 | +
|
| 116 | +processors: |
| 117 | + transform/httpcheck-6d24bb0d-5349-4714-a7ea-2988abcb928b: |
| 118 | + metric_statements: |
| 119 | + - delete_key(datapoint.attributes,"http.status_class") |
| 120 | +
|
| 121 | +exporters: |
| 122 | + debug/default: |
| 123 | + verbosity: detailed |
| 124 | +
|
| 125 | +service: |
| 126 | + pipelines: |
| 127 | + metrics/httpcheck-6d24bb0d-5349-4714-a7ea-2988abcb928b: |
| 128 | + receivers: [httpcheck/httpcheck-6d24bb0d-5349-4714-a7ea-2988abcb928b] |
| 129 | + processors: [transform/httpcheck-6d24bb0d-5349-4714-a7ea-2988abcb928b] |
| 130 | + exporters: [debug/default] |
| 131 | +``` |
| 132 | + |
| 133 | +## OTel Mode |
| 134 | + |
| 135 | +The elastic agent can also be executed in "Otel mode" by executing the `elastic-agent otel` command. This immediately invokes |
| 136 | +the entrypoint of the EDOT OpenTelemetry collector bypassing all other Elastic Agent functionality. In this mode Fleet management is |
| 137 | +not available and elastic-agent.yml configurations cannot be executed. Beat receivers are still usable in this mode, but they must be |
| 138 | +configured manually like any other receiver. |
| 139 | + |
| 140 | +An example showing how to configure Beat receivers directly in a collector pipeline that will execute with the `elastic-agent otel` command |
| 141 | +follows below. The pipeline below is a simplified version of the one generated to run the `filestream` and `system/metrics` inputs as receivers |
| 142 | +show earlier. |
| 143 | + |
| 144 | +```yaml |
| 145 | +receivers: |
| 146 | + filebeatreceiver: |
| 147 | + filebeat: |
| 148 | + inputs: |
| 149 | + - data_stream: |
| 150 | + dataset: generic |
| 151 | + id: filestream-receiver |
| 152 | + index: logs-generic-default |
| 153 | + paths: |
| 154 | + - /var/log/*.log |
| 155 | + type: filestream |
| 156 | + output: |
| 157 | + otelconsumer: {} |
| 158 | + metricbeatreceiver: |
| 159 | + metricbeat: |
| 160 | + modules: |
| 161 | + - data_stream: |
| 162 | + dataset: system.cpu |
| 163 | + index: metrics-system.cpu-default |
| 164 | + metricsets: |
| 165 | + - cpu |
| 166 | + module: system |
| 167 | + output: |
| 168 | + otelconsumer: {} |
| 169 | +exporters: |
| 170 | + elasticsearch/_agent-component/default: |
| 171 | + api_key: placeholder |
| 172 | + compression: gzip |
| 173 | + compression_params: |
| 174 | + level: 1 |
| 175 | + endpoints: |
| 176 | + - http://localhost:9200 |
| 177 | + logs_dynamic_id: |
| 178 | + enabled: true |
| 179 | + mapping: |
| 180 | + mode: bodymap |
| 181 | +service: |
| 182 | + pipelines: |
| 183 | + logs: |
| 184 | + exporters: |
| 185 | + - elasticsearch/_agent-component/default |
| 186 | + receivers: |
| 187 | + - filebeatreceiver |
| 188 | + - metricbeatreceiver |
| 189 | +``` |
0 commit comments