Skip to content

Commit 5961a2d

Browse files
authored
Add docs about hints and templates autodiscovery priority (#30343)
1 parent 9cecf3a commit 5961a2d

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

filebeat/docs/autodiscover-hints.asciidoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,33 @@ Define an ingest pipeline ID to be added to the {beatname_uc} input/module confi
100100
co.elastic.logs/pipeline: custom-pipeline
101101
-----
102102

103+
When hints are used along with templates, then hints will be evaluated only in case
104+
there is no template's condition that resolves to true. For example:
105+
106+
[source,yaml]
107+
-----
108+
filebeat.autodiscover.providers:
109+
- type: docker
110+
hints.enabled: true
111+
hints.default_config:
112+
type: container
113+
paths:
114+
- /var/lib/docker/containers/${data.container.id}/*.log
115+
templates:
116+
- condition:
117+
equals:
118+
docker.container.labels.type: "pipeline"
119+
config:
120+
- type: container
121+
paths:
122+
- "/var/lib/docker/containers/${data.docker.container.id}/*.log"
123+
pipeline: my-pipeline
124+
-----
125+
126+
In this example first the condition `docker.container.labels.type: "pipeline"` is evaluated
127+
and if not matched the hints will be processed and if there is again no valid config
128+
the `hints.default_config` will be used.
129+
103130
[float]
104131
==== Kubernetes
105132

heartbeat/docs/autodiscover-hints.asciidoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,29 @@ co.elastic.monitor/processors.drop_fields.fields: "field3"
4848

4949
In the above sample the processor definition tagged with `1` would be executed first.
5050

51+
When hints are used along with templates, then hints will be evaluated only in case
52+
there is no template's condition that resolves to true. For example:
53+
54+
[source,yaml]
55+
-----
56+
heartbeat.autodiscover:
57+
- type: docker
58+
hints.enabled: true
59+
templates:
60+
- condition:
61+
contains:
62+
docker.container.image: redis
63+
config:
64+
- type: tcp
65+
hosts: ["${data.host}:${data.port}"]
66+
schedule: "@every 1s"
67+
timeout: 1s
68+
-----
69+
70+
In this example first the condition `docker.container.image: redis` is evaluated
71+
and if not matched the hints will be processed and if there is again no valid config
72+
the `hints.default_config` will be used.
73+
5174
[float]
5275
==== Kubernetes
5376

metricbeat/docs/autodiscover-hints.asciidoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,28 @@ co.elastic.logs/processors.add_locale.abbrevation: "PST"
9696

9797
In the above sample the processor definition tagged with `1` would be executed first.
9898

99+
When hints are used along with templates, then hints will be evaluated only in case
100+
there is no template's condition that resolves to true. For example:
101+
102+
[source,yaml]
103+
-----
104+
metricbeat.autodiscover.providers:
105+
- type: kubernetes
106+
hints.enabled: true
107+
templates:
108+
- condition:
109+
contains:
110+
kubernetes.annotations.prometheus.io/scrape: "true"
111+
config:
112+
- module: prometheus
113+
metricsets: ["collector"]
114+
hosts: "${data.host}:${data.port}"
115+
-----
116+
117+
In this example first the condition `kubernetes.annotations.prometheus.io/scrape: "true"`
118+
is evaluated and if not matched the hints will be processed.
119+
120+
99121
[float]
100122
=== Kubernetes
101123

0 commit comments

Comments
 (0)