diff --git a/filebeat/docs/autodiscover-docker-config.asciidoc b/filebeat/docs/autodiscover-docker-config.asciidoc new file mode 100644 index 000000000000..c632cee0be88 --- /dev/null +++ b/filebeat/docs/autodiscover-docker-config.asciidoc @@ -0,0 +1,39 @@ +Filebeat supports templates for both prospectors and modules. + +["source","yaml",subs="attributes"] +------------------------------------------------------------------------------------- +filebeat.autodiscover: + providers: + - type: docker + templates: + - condition: + equals: + docker.container.image: redis + config: + - type: docker + container.ids: + - "${data.docker.container.id}" + exclude_lines: ["^\\s+[\\-`('.|_]"] # drop asciiart lines +------------------------------------------------------------------------------------- + +This configuration launches a `docker` logs prospector for all containers running an image with `redis` in the name. + +If you are using modules, you can override the default prospector and use the docker prospector instead. + +["source","yaml",subs="attributes"] +------------------------------------------------------------------------------------- +filebeat.autodiscover: + providers: + - type: docker + templates: + - condition: + equals: + docker.container.image: "redis" + config: + - module: redis + log: + prospector: + type: docker + container.ids: + - "${data.docker.container.id}" +------------------------------------------------------------------------------------- diff --git a/filebeat/docs/configuring-howto.asciidoc b/filebeat/docs/configuring-howto.asciidoc index b16c9134ce4a..f1e3b44897f3 100644 --- a/filebeat/docs/configuring-howto.asciidoc +++ b/filebeat/docs/configuring-howto.asciidoc @@ -36,6 +36,7 @@ The following topics describe how to configure Filebeat: * <> * <> * <> +* <> * <> * <> * <<{beatname_lc}-reference-yml>> @@ -78,6 +79,8 @@ include::../../libbeat/docs/loggingconfig.asciidoc[] :standalone: include::../../libbeat/docs/shared-env-vars.asciidoc[] +include::../../libbeat/docs/shared-autodiscover.asciidoc[] + :standalone: :allplatforms: include::../../libbeat/docs/yaml.asciidoc[] @@ -85,4 +88,3 @@ include::../../libbeat/docs/yaml.asciidoc[] include::../../libbeat/docs/regexp.asciidoc[] include::../../libbeat/docs/reference-yml.asciidoc[] - diff --git a/libbeat/docs/shared-autodiscover.asciidoc b/libbeat/docs/shared-autodiscover.asciidoc new file mode 100644 index 000000000000..6c506f5af24c --- /dev/null +++ b/libbeat/docs/shared-autodiscover.asciidoc @@ -0,0 +1,68 @@ +[[configuration-autodiscover]] +== Autodiscover + +Autodiscover allows you to watch for system changes and dynamically adapt settings to them, as they happen. +This is specially useful when running your infrastructure on containers. + +When you run an application on containers it becomes a moving target to the monitoring system. Autodiscover +allows you to automatically detect what's running and update settings to monitor it. + +You can define configuration templates for different containers. Autodiscover subsystem will use them +to monitor services as they start running. + +You define autodiscover settings in the +{beatname_lc}.autodiscover+ section of the +{beatname_lc}.yml+ +config file. To enable autodiscover, you specify a list of providers. + +[float] +=== Providers + +Autodiscover providers work by watching for events on the system and translating those events into internal autodiscover +events with a common format. When you configure the provider, you can use fields from the autodiscover event to set +conditions that, when met, launch specific configurations. + +[float] +===== Docker + +Docker autodiscover provider watches for Docker containers start and stop. These are the available fields on every +event: + + * host + * port + * docker.container.id + * docker.container.image + * docker.container.name + * docker.container.labels + + +For example: + +[source,yaml] +------------------------------------------------------------------------------------- +{ + "host": "10.4.15.9", + "port": 6379, + "docker": { + "container": { + "id": "382184ecdb385cfd5d1f1a65f78911054c8511ae009635300ac28b4fc357ce51" + "name": "redis", + "image": "redis:3.2.11", + "labels": { + "io.kubernetes.pod.namespace": "default" + ... + } + } + } +} +------------------------------------------------------------------------------------- + +You can define a set of configuration templates to be applied when the condition matches an event. Templates define +a condition to match on autodiscover events, together with the list of configurations to launch when this condition +happens. + +Conditions match events from the provider. Providers use the same format for <> that +processors use. + +Configuration templates can contain variables from the autodiscover event. They can be accessed under `data` namespace. +For example, with the example event, "`${data.port}`" will resolves to `6379`. + +include::../../{beatname_lc}/docs/autodiscover-docker-config.asciidoc[] diff --git a/metricbeat/docs/autodiscover-docker-config.asciidoc b/metricbeat/docs/autodiscover-docker-config.asciidoc new file mode 100644 index 000000000000..75be8f346d11 --- /dev/null +++ b/metricbeat/docs/autodiscover-docker-config.asciidoc @@ -0,0 +1,18 @@ +Metricbeat supports templates for modules: + +["source","yaml",subs="attributes"] +------------------------------------------------------------------------------------- +metricbeat.autodiscover: + providers: + - type: docker + templates: + - condition: + contains: + docker.container.image: "redis" + config: + - module: redis + metricsets: ["info", "keyspace"] + hosts: "${data.host}:6379" +------------------------------------------------------------------------------------- + +This configuration launches a `redis` module for all containers running an image with `redis` in the name. diff --git a/metricbeat/docs/configuring-howto.asciidoc b/metricbeat/docs/configuring-howto.asciidoc index d216fd0b168e..ee57058749db 100644 --- a/metricbeat/docs/configuring-howto.asciidoc +++ b/metricbeat/docs/configuring-howto.asciidoc @@ -33,6 +33,7 @@ The following topics describe how to configure Metricbeat: * <> * <> * <> +* <> * <> * <> * <<{beatname_lc}-reference-yml>> @@ -67,6 +68,8 @@ include::../../libbeat/docs/loggingconfig.asciidoc[] :standalone: include::../../libbeat/docs/shared-env-vars.asciidoc[] +include::../../libbeat/docs/shared-autodiscover.asciidoc[] + :standalone: :allplatforms: include::../../libbeat/docs/yaml.asciidoc[] @@ -74,6 +77,3 @@ include::../../libbeat/docs/yaml.asciidoc[] include::../../libbeat/docs/regexp.asciidoc[] include::../../libbeat/docs/reference-yml.asciidoc[] - - -