You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add add_kubernetes_metadata processor to OTel Beat processor (#47942) (#47981)
* feat: add `add_kubernetes_metadata` processor to OTel Beat processor
* test: use test Logger in tests
* refactor: fix typo in function name
* test: revert to no-op logger
(cherry picked from commit 3a9d1f4)
Co-authored-by: Andrzej Stencel <[email protected]>
> This component is currently in development and functionality is limited.
11
-
12
9
The Beat processor (`beat`) is an OpenTelemetry Collector processor that wraps the [Beat processors].
13
10
This allows you to use Beat processors like e.g. [add_host_metadata] anywhere in the OpenTelemetry Collector's pipeline, independently of Beat receivers.
14
11
@@ -17,11 +14,10 @@ This allows you to use Beat processors like e.g. [add_host_metadata] anywhere in
17
14
> This is because it relies on the specific structure of telemetry emitted by those components.
18
15
> Using it with data coming from other components is not recommended and may result in unexpected behavior.
19
16
20
-
The processor enriches the telemetry with host metadata by using the [add_host_metadata] processor under the hood.
21
-
Note that configuration is limited at this stage.
22
-
Host metadata is added unconditionally and cannot be disabled.
23
-
You can configure the host metadata enrichment using the options that the [add_host_metadata] processor allows.
24
-
The only exception is that the option `replace_fields` is always set to `true` and setting it to `false` has no effect.
17
+
Here are the currently supported processors:
18
+
19
+
-[add_host_metadata]
20
+
-[add_kubernetes_metadata]
25
21
26
22
## Default processors in Beat receivers
27
23
@@ -61,11 +57,17 @@ receivers:
61
57
The above Filebeat receiver configuration specifies an empty list of processors.
62
58
In this case, none of the default processors are ran as part of the Filebeat receiver.
63
59
64
-
## Example
60
+
## Examples
65
61
66
-
The following [Filebeat receiver] configuration
62
+
The following OpenTelemetry Collector configuration using only the [Filebeat receiver]:
67
63
68
64
```yaml
65
+
service:
66
+
pipelines:
67
+
logs:
68
+
receivers: [filebeatreceiver]
69
+
exporters: [debug]
70
+
69
71
receivers:
70
72
filebeatreceiver:
71
73
filebeat:
@@ -78,11 +80,21 @@ receivers:
78
80
- add_host_metadata:
79
81
netinfo:
80
82
enabled: false
83
+
84
+
exporters:
85
+
debug:
81
86
```
82
87
83
88
is functionally equivalent to this one, using the Beat processor:
84
89
85
90
```yaml
91
+
service:
92
+
pipelines:
93
+
logs:
94
+
receivers: [filebeatreceiver]
95
+
processors: [beat]
96
+
exporters: [debug]
97
+
86
98
receivers:
87
99
filebeatreceiver:
88
100
filebeat:
@@ -99,12 +111,50 @@ processors:
99
111
- add_host_metadata:
100
112
netinfo:
101
113
enabled: false
114
+
115
+
exporters:
116
+
debug:
102
117
```
103
118
119
+
## Using the `add_host_metadata` processor
120
+
121
+
To use the [add_host_metadata] processor, configure the processor as follows:
122
+
123
+
```yaml
124
+
processors:
125
+
beat:
126
+
processors:
127
+
- add_host_metadata:
128
+
```
129
+
130
+
You can configure the host metadata enrichment using the options supported by the [add_host_metadata] processor.
131
+
132
+
## Using the `add_kubernetes_metadata` processor
133
+
134
+
To use the [add_kubernetes_metadata] processor, configure the processor as follows:
135
+
136
+
```yaml
137
+
processors:
138
+
beat:
139
+
processors:
140
+
- add_kubernetes_metadata:
141
+
indexers:
142
+
- container:
143
+
matchers:
144
+
- logs_path:
145
+
```
146
+
147
+
You can configure the Kubernetes metadata enrichment using the options supported by the [add_kubernetes_metadata] processor.
148
+
149
+
Note that you need to explicitly configure at least one [indexer][indexers] and at least one [matcher][matchers] for the enrichment to work.
150
+
In the example above, the `container` indexer and the `logs_path` matcher are configured.
0 commit comments