Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs about hints and templates autodiscovery priority #30343

Merged
merged 2 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions filebeat/docs/autodiscover-hints.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ Define an ingest pipeline ID to be added to the {beatname_uc} input/module confi
co.elastic.logs/pipeline: custom-pipeline
-----

When hints are used along with templates, then hints will be evaluated only in case
there is no template's condition that resolves to true. For example:

[source,yaml]
-----
filebeat.autodiscover.providers:
- type: docker
hints.enabled: true
hints.default_config:
type: container
paths:
- /var/lib/docker/containers/${data.container.id}/*.log
templates:
- condition:
equals:
docker.container.labels.type: "pipeline"
config:
- type: container
paths:
- "/var/lib/docker/containers/${data.docker.container.id}/*.log"
pipeline: my-pipeline
-----

In this example first the condition `docker.container.labels.type: "pipeline"` is evaluated
and if not matched the hints will be processed and if there is again no valid config
the `hints.default_config` will be used.

[float]
==== Kubernetes

Expand Down
23 changes: 23 additions & 0 deletions heartbeat/docs/autodiscover-hints.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ co.elastic.monitor/processors.drop_fields.fields: "field3"

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

When hints are used along with templates, then hints will be evaluated only in case
there is no template's condition that resolves to true. For example:

[source,yaml]
-----
heartbeat.autodiscover:
- type: docker
hints.enabled: true
templates:
- condition:
contains:
docker.container.image: redis
config:
- type: tcp
hosts: ["${data.host}:${data.port}"]
schedule: "@every 1s"
timeout: 1s
-----

In this example first the condition `docker.container.image: redis` is evaluated
and if not matched the hints will be processed and if there is again no valid config
the `hints.default_config` will be used.

[float]
==== Kubernetes

Expand Down
22 changes: 22 additions & 0 deletions metricbeat/docs/autodiscover-hints.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@ co.elastic.logs/processors.add_locale.abbrevation: "PST"

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

When hints are used along with templates, then hints will be evaluated only in case
there is no template's condition that resolves to true. For example:

[source,yaml]
-----
metricbeat.autodiscover.providers:
- type: kubernetes
hints.enabled: true
templates:
- condition:
contains:
kubernetes.annotations.prometheus.io/scrape: "true"
config:
- module: prometheus
metricsets: ["collector"]
hosts: "${data.host}:${data.port}"
-----

In this example first the condition `kubernetes.annotations.prometheus.io/scrape: "true"`
is evaluated and if not matched the hints will be processed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metricbeat doesn't have hints.default_config, that is why it is omitted here?

Copy link
Member Author

@ChrsMark ChrsMark Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap. See

compared to
DefaultConfig: defaultCfg,
. In fact I don't think it would even had any reason to have a default config for metrics. Logs is kind of special since all containers can provide them in a unified way.



[float]
=== Kubernetes

Expand Down