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
Copy file name to clipboardExpand all lines: content/en/containers/guide/container-discovery-management.md
+85-66Lines changed: 85 additions & 66 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ By default, the Datadog Agent automatically discovers all containers available.
21
21
22
22
In a containerized environment, you should deploy the Datadog Agent once per host. Each Datadog Agent deployed automatically discovers and monitors all containers on its respective host.
23
23
24
-
You can adjust the discovery rules for the Agent to restrict metric and log collection. Any containers restricted from metric collection are also restricted for any [Autodiscovery][2]-based Agent integrations.
24
+
You can adjust the discovery rules for the Agent to restrict metric and log collection. Any containers restricted from metric collection are also restricted for any [Autodiscovery][2]-based Agent integrations.
25
25
26
26
When the logs [`containerCollectAll` option][1] is enabled, the Agent collects logs from all discovered containers. These filtering options do not affect log collection if `containerCollectAll` is not enabled.
27
27
@@ -32,9 +32,10 @@ You can set exceptions in two ways:
32
32
33
33
**Note**: The `kubernetes.containers.running`, `kubernetes.pods.running`, `docker.containers.running`, `.stopped`, `.running.total`, and `.stopped.total` metrics are not affected by these settings and always count all containers.
34
34
35
-
## Agent configuration
35
+
## Simple pattern matching
36
36
37
37
Use the environment variables in the table below to configure container filtering. Each inclusion or exclusion is defined as a list of space-separated regex strings. You can include or exclude containers based on their:
38
+
38
39
- container name (`name`)
39
40
- container image name (`image`)
40
41
- Kubernetes namespace (`kube_namespace`)
@@ -46,6 +47,7 @@ The `name` parameter only applies to container names, not pod names, even if the
46
47
</div>
47
48
48
49
### Environment variables
50
+
49
51
In **Agent v7.20+**, use the following environment variables to exclude containers by image name, container name, or Kubernetes namespace. Logs and metrics are not collected from excluded containers.
50
52
51
53
| Environment variable | Description |
@@ -57,7 +59,71 @@ In **Agent v7.20+**, use the following environment variables to exclude containe
57
59
|`DD_CONTAINER_INCLUDE_METRICS`| Allowlist of containers whose metrics are included. |
58
60
|`DD_CONTAINER_INCLUDE_LOGS`| Allowlist of containers whose logs are included. |
59
61
60
-
In **Agent <=v7.19**, use the environment variables `DD_AC_INCLUDE` and `DD_AC_EXCLUDE` to include or exclude a container by image or name. These environment variables are deprecated in later Agent versions.
In Datadog Operator, set these environment variables under `spec.override.nodeAgent.env`.
68
+
69
+
##### Example
70
+
71
+
```yaml
72
+
apiVersion: datadoghq.com/v2alpha1
73
+
kind: DatadogAgent
74
+
metadata:
75
+
name: datadog
76
+
spec:
77
+
global:
78
+
credentials:
79
+
apiKey: <DATADOG_API_KEY>
80
+
override:
81
+
nodeAgent:
82
+
env:
83
+
- name: DD_CONTAINER_EXCLUDE
84
+
value: "image:<IMAGE_NAME>"
85
+
```
86
+
87
+
{{% /tab %}}
88
+
{{% tab "Helm" %}}
89
+
90
+
In your Helm chart, supply a space-separated string to `datadog.containerExclude`, `datadog.containerInclude`, `datadog.containerExcludeLogs`, `datadog.containerIncludeLogs`, `datadog.containerExcludeMetrics`, or `datadog.containerIncludeMetrics`.
There is no interaction between the global lists and the selective (logs and metrics) lists. In other words, you cannot exclude a container globally (`DD_CONTAINER_EXCLUDE`) and then include it with `DD_CONTAINER_INCLUDE_LOGS` and `DD_CONTAINER_INCLUDE_METRICS`.
134
201
135
-
### Setting environment variables
136
-
{{< tabs >}}
137
-
{{% tab "Datadog Operator" %}}
138
-
139
-
In Datadog Operator, set these environment variables under `spec.override.nodeAgent.env`.
140
-
141
-
##### Example
142
-
143
-
```yaml
144
-
apiVersion: datadoghq.com/v2alpha1
145
-
kind: DatadogAgent
146
-
metadata:
147
-
name: datadog
148
-
spec:
149
-
global:
150
-
credentials:
151
-
apiKey: <DATADOG_API_KEY>
152
-
override:
153
-
nodeAgent:
154
-
env:
155
-
- name: DD_CONTAINER_EXCLUDE
156
-
value: "image:<IMAGE_NAME>"
157
-
```
158
-
{{% /tab %}}
159
-
{{% tab "Helm" %}}
160
-
161
-
In your Helm chart, supply a space-separated string to `datadog.containerExclude`, `datadog.containerInclude`, `datadog.containerExcludeLogs`, `datadog.containerIncludeLogs`, `datadog.containerExcludeMetrics`, or `datadog.containerIncludeMetrics`.
In environments where you are not using Helm or the Operator, the following environment variables can be passed to the Agent container at startup.
175
-
176
-
##### Example Docker
177
-
```shell
178
-
docker run -e DD_CONTAINER_EXCLUDE=image:<IMAGE_NAME> ...
179
-
```
180
-
181
-
##### Example ECS
182
-
```json
183
-
"environment": [
184
-
{
185
-
"name": "DD_CONTAINER_EXCLUDE",
186
-
"value": "image:<IMAGE_NAME>"
187
-
},
188
-
...
189
-
]
190
-
```
191
-
192
-
{{% /tab %}}
193
-
{{< /tabs >}}
194
-
195
-
#### Pause containers
202
+
### Pause containers
196
203
197
204
The Datadog Agent excludes Kubernetes and OpenShift pause containers by default. This prevents their metric collection and counting as billable containers. They are still counted in the container count metrics such as `kubernetes.containers.running` and `docker.containers.running`.
198
205
@@ -220,6 +227,7 @@ spec:
220
227
- name: DD_EXCLUDE_PAUSE_CONTAINER
221
228
value: "false"
222
229
```
230
+
223
231
{{% /tab %}}
224
232
{{% tab "Helm" %}}
225
233
@@ -243,6 +251,13 @@ Set `DD_EXCLUDE_PAUSE_CONTAINER` to `false`.
243
251
{{% /tab %}}
244
252
{{< /tabs >}}
245
253
254
+
## Advanced CEL exclusion
255
+
256
+
Use the parameters in the table below to configure filtering for container
257
+
258
+
259
+
. Each inclusion or exclusion is defined as a list of space-separated regex strings. You can include or exclude containers based on their:
260
+
246
261
## Pod exclude configuration
247
262
248
263
In **Agent v7.45+** you can set annotations on your Kubernetes pods to control Autodiscovery. Set the following annotations with the value `"true"` to add exclusion rules.
@@ -260,7 +275,8 @@ The `ad.datadoghq.com/exclude` annotation set on the application pod takes the h
260
275
261
276
When applying annotation-based exclusions, the Agent checks for all relevant exclusion annotations on the container. For example, when configuring logs for an NGINX container, the Agent will look for `ad.datadoghq.com/exclude`, `ad.datadoghq.com/logs_exclude`, `ad.datadoghq.com/nginx.exclude`, or `ad.datadoghq.com/nginx.logs_exclude` annotations to be `true` on the pod. The same applies for metrics.
262
277
263
-
#### Exclude the entire pod:
278
+
#### Exclude the entire pod
279
+
264
280
```yaml
265
281
apiVersion: apps/v1
266
282
kind: Deployment
@@ -276,7 +292,8 @@ spec:
276
292
#(...)
277
293
```
278
294
279
-
#### Exclude log collection from a container:
295
+
#### Exclude log collection from a container
296
+
280
297
```yaml
281
298
apiVersion: apps/v1
282
299
kind: Deployment
@@ -316,6 +333,7 @@ In **Agent v7.70+**, you can restrict security monitoring for specific container
316
333
317
334
{{< tabs >}}
318
335
{{% tab "Helm" %}}
336
+
319
337
| Feature | Include container | Exclude container |
0 commit comments