From b274f926db121d66ee589e2966fe3212357cd6cc Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Wed, 18 Nov 2020 10:51:53 -0500 Subject: [PATCH 1/3] Fix local_dynamic documentation and add providers inline doc. Fix issues with the configuration and usage of the local_dynamic provider and add inline documentation in the yaml files. --- .../_meta/config/common.p2.yml.tmpl | 2 + .../_meta/config/common.reference.p2.yml.tmpl | 2 + .../_meta/config/providers.yml.tmpl | 42 ++++++++++++++++++ .../docs/elastic-agent-providers.asciidoc | 24 ++++++---- .../elastic-agent/elastic-agent.reference.yml | 44 +++++++++++++++++++ x-pack/elastic-agent/elastic-agent.yml | 44 +++++++++++++++++++ 6 files changed, 150 insertions(+), 8 deletions(-) create mode 100644 x-pack/elastic-agent/_meta/config/providers.yml.tmpl diff --git a/x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl b/x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl index e88dea9534e..4a2fb93d10f 100644 --- a/x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl +++ b/x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl @@ -200,3 +200,5 @@ agent.logging.to_stderr: true # information. Recommended to use in combination with `logging.json=true` # Defaults to false. #agent.logging.ecs: false + +{{template "providers.yml.tmpl" .}} diff --git a/x-pack/elastic-agent/_meta/config/common.reference.p2.yml.tmpl b/x-pack/elastic-agent/_meta/config/common.reference.p2.yml.tmpl index 55ed22e65a3..53c90a7f783 100644 --- a/x-pack/elastic-agent/_meta/config/common.reference.p2.yml.tmpl +++ b/x-pack/elastic-agent/_meta/config/common.reference.p2.yml.tmpl @@ -200,3 +200,5 @@ agent.logging.to_stderr: true # information. Recommended to use in combination with `logging.json=true` # Defaults to false. #agent.logging.ecs: false + +{{template "providers.yml.tmpl" .}} diff --git a/x-pack/elastic-agent/_meta/config/providers.yml.tmpl b/x-pack/elastic-agent/_meta/config/providers.yml.tmpl new file mode 100644 index 00000000000..dde7eff90fd --- /dev/null +++ b/x-pack/elastic-agent/_meta/config/providers.yml.tmpl @@ -0,0 +1,42 @@ +# Providers + +# Providers supply the key/values pairs that are used for variable substitution +# and conditionals. Each provider's keys are automatically prefixed with the name +# of the provider. + +#providers: + +# Agent provides information about the running agent. +# agent: +# enabled: true + +# Docker provides inventory information from Docker. +# docker: +# enabled: false +# host: "unix:///var/run/docker.sock" +# cleanup_timeout: 60 + +# Env providers information about the running environment. +# env: +# enabled: true + +# Host provides information about the current host. +# host: +# enabled: true + +# Local provides custom keys to use as variable. +# local: +# enabled: true +# vars: +# foo: bar + +# Local dynamic allows you to define multiple key/values to generate multiple configurations. +# local_dynamic: +# enabled: true +# items: +# - vars: +# my_var: key1 +# - vars: +# my_var: key2 +# - vars: +# my_var: key3 diff --git a/x-pack/elastic-agent/docs/elastic-agent-providers.asciidoc b/x-pack/elastic-agent/docs/elastic-agent-providers.asciidoc index 868c5b2fd2e..44125efe349 100644 --- a/x-pack/elastic-agent/docs/elastic-agent-providers.asciidoc +++ b/x-pack/elastic-agent/docs/elastic-agent-providers.asciidoc @@ -172,13 +172,18 @@ defines 3 values for `item`: ---- inputs: - type: logfile - paths: "/var/${item}/app.log" + streams: + - paths: "/var/${local_dynamic.my_var}/app.log" providers: - vars: - - item: key1 - - item: key2 - - item: key3 + local_dynamic: + items: + - vars: + my_var: key1 + - vars: + my_var: key2 + - vars: + my_var: key3 ---- The configuration generated by this policy looks like: @@ -187,11 +192,14 @@ The configuration generated by this policy looks like: ---- inputs: - type: logfile - paths: "/var/key1/app.log" + streams: + - paths: "/var/key1/app.log" - type: logfile - paths: "/var/key2/app.log" + streams: + - paths: "/var/key2/app.log" - type: logfile - paths: "/var/key3/app.log" + streams: + - paths: "/var/key3/app.log" ---- [[docker-provider]] diff --git a/x-pack/elastic-agent/elastic-agent.reference.yml b/x-pack/elastic-agent/elastic-agent.reference.yml index 08a12d7907a..8a15b1c6ab7 100644 --- a/x-pack/elastic-agent/elastic-agent.reference.yml +++ b/x-pack/elastic-agent/elastic-agent.reference.yml @@ -207,3 +207,47 @@ agent.logging.to_stderr: true # Defaults to false. #agent.logging.ecs: false +# Providers + +# Providers supply the key/values pairs that are used for variable substitution +# and conditionals. Each provider's keys are automatically prefixed with the name +# of the provider. + +#providers: + +# Agent provides information about the running agent. +# agent: +# enabled: true + +# Docker provides inventory information from Docker. +# docker: +# enabled: false +# host: "unix:///var/run/docker.sock" +# cleanup_timeout: 60 + +# Env providers information about the running environment. +# env: +# enabled: true + +# Host provides information about the current host. +# host: +# enabled: true + +# Local provides custom keys to use as variable. +# local: +# enabled: true +# vars: +# foo: bar + +# Local dynamic allows you to define multiple key/values to generate multiple configurations. +# local_dynamic: +# enabled: true +# items: +# - vars: +# my_var: key1 +# - vars: +# my_var: key2 +# - vars: +# my_var: key3 + + diff --git a/x-pack/elastic-agent/elastic-agent.yml b/x-pack/elastic-agent/elastic-agent.yml index 232ff03c62e..7657942bd54 100644 --- a/x-pack/elastic-agent/elastic-agent.yml +++ b/x-pack/elastic-agent/elastic-agent.yml @@ -207,3 +207,47 @@ agent.logging.to_stderr: true # Defaults to false. #agent.logging.ecs: false +# Providers + +# Providers supply the key/values pairs that are used for variable substitution +# and conditionals. Each provider's keys are automatically prefixed with the name +# of the provider. + +#providers: + +# Agent provides information about the running agent. +# agent: +# enabled: true + +# Docker provides inventory information from Docker. +# docker: +# enabled: false +# host: "unix:///var/run/docker.sock" +# cleanup_timeout: 60 + +# Env providers information about the running environment. +# env: +# enabled: true + +# Host provides information about the current host. +# host: +# enabled: true + +# Local provides custom keys to use as variable. +# local: +# enabled: true +# vars: +# foo: bar + +# Local dynamic allows you to define multiple key/values to generate multiple configurations. +# local_dynamic: +# enabled: true +# items: +# - vars: +# my_var: key1 +# - vars: +# my_var: key2 +# - vars: +# my_var: key3 + + From cde94c6368896c7a43830ba4f7fdd81b298e180f Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Wed, 18 Nov 2020 10:57:22 -0500 Subject: [PATCH 2/3] Update docker yml --- .../config/elastic-agent.docker.yml.tmpl | 2 + x-pack/elastic-agent/elastic-agent.docker.yml | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/x-pack/elastic-agent/_meta/config/elastic-agent.docker.yml.tmpl b/x-pack/elastic-agent/_meta/config/elastic-agent.docker.yml.tmpl index 2f8187a1604..bb77ce3947c 100644 --- a/x-pack/elastic-agent/_meta/config/elastic-agent.docker.yml.tmpl +++ b/x-pack/elastic-agent/_meta/config/elastic-agent.docker.yml.tmpl @@ -200,3 +200,5 @@ agent.logging.to_stderr: true # information. Recommended to use in combination with `logging.json=true` # Defaults to false. #agent.logging.ecs: false + +{{template "providers.yml.tmpl" .}} diff --git a/x-pack/elastic-agent/elastic-agent.docker.yml b/x-pack/elastic-agent/elastic-agent.docker.yml index 2f8187a1604..5aae02a3e9d 100644 --- a/x-pack/elastic-agent/elastic-agent.docker.yml +++ b/x-pack/elastic-agent/elastic-agent.docker.yml @@ -200,3 +200,47 @@ agent.logging.to_stderr: true # information. Recommended to use in combination with `logging.json=true` # Defaults to false. #agent.logging.ecs: false + +# Providers + +# Providers supply the key/values pairs that are used for variable substitution +# and conditionals. Each provider's keys are automatically prefixed with the name +# of the provider. + +#providers: + +# Agent provides information about the running agent. +# agent: +# enabled: true + +# Docker provides inventory information from Docker. +# docker: +# enabled: false +# host: "unix:///var/run/docker.sock" +# cleanup_timeout: 60 + +# Env providers information about the running environment. +# env: +# enabled: true + +# Host provides information about the current host. +# host: +# enabled: true + +# Local provides custom keys to use as variable. +# local: +# enabled: true +# vars: +# foo: bar + +# Local dynamic allows you to define multiple key/values to generate multiple configurations. +# local_dynamic: +# enabled: true +# items: +# - vars: +# my_var: key1 +# - vars: +# my_var: key2 +# - vars: +# my_var: key3 + From 62d0d54d842ebb2c682e8e5445c4028249fcd61a Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Mon, 23 Nov 2020 09:38:58 -0500 Subject: [PATCH 3/3] enable should be true in the yaml --- x-pack/elastic-agent/_meta/config/providers.yml.tmpl | 2 +- x-pack/elastic-agent/elastic-agent.docker.yml | 2 +- x-pack/elastic-agent/elastic-agent.reference.yml | 2 +- x-pack/elastic-agent/elastic-agent.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/elastic-agent/_meta/config/providers.yml.tmpl b/x-pack/elastic-agent/_meta/config/providers.yml.tmpl index dde7eff90fd..02d81408cb0 100644 --- a/x-pack/elastic-agent/_meta/config/providers.yml.tmpl +++ b/x-pack/elastic-agent/_meta/config/providers.yml.tmpl @@ -12,7 +12,7 @@ # Docker provides inventory information from Docker. # docker: -# enabled: false +# enabled: true # host: "unix:///var/run/docker.sock" # cleanup_timeout: 60 diff --git a/x-pack/elastic-agent/elastic-agent.docker.yml b/x-pack/elastic-agent/elastic-agent.docker.yml index 5aae02a3e9d..6028291bfc6 100644 --- a/x-pack/elastic-agent/elastic-agent.docker.yml +++ b/x-pack/elastic-agent/elastic-agent.docker.yml @@ -215,7 +215,7 @@ agent.logging.to_stderr: true # Docker provides inventory information from Docker. # docker: -# enabled: false +# enabled: true # host: "unix:///var/run/docker.sock" # cleanup_timeout: 60 diff --git a/x-pack/elastic-agent/elastic-agent.reference.yml b/x-pack/elastic-agent/elastic-agent.reference.yml index 8a15b1c6ab7..022ce746647 100644 --- a/x-pack/elastic-agent/elastic-agent.reference.yml +++ b/x-pack/elastic-agent/elastic-agent.reference.yml @@ -221,7 +221,7 @@ agent.logging.to_stderr: true # Docker provides inventory information from Docker. # docker: -# enabled: false +# enabled: true # host: "unix:///var/run/docker.sock" # cleanup_timeout: 60 diff --git a/x-pack/elastic-agent/elastic-agent.yml b/x-pack/elastic-agent/elastic-agent.yml index 7657942bd54..6134c396036 100644 --- a/x-pack/elastic-agent/elastic-agent.yml +++ b/x-pack/elastic-agent/elastic-agent.yml @@ -221,7 +221,7 @@ agent.logging.to_stderr: true # Docker provides inventory information from Docker. # docker: -# enabled: false +# enabled: true # host: "unix:///var/run/docker.sock" # cleanup_timeout: 60