Skip to content

Commit

Permalink
Fix local_dynamic documentation and add providers inline doc. (elasti…
Browse files Browse the repository at this point in the history
…c#22657)

* 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.

* Update docker yml

* enable should be true in the yaml
  • Loading branch information
ph authored Dec 1, 2020
1 parent 8425e41 commit 4b30d9a
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 8 deletions.
2 changes: 2 additions & 0 deletions x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" .}}
Original file line number Diff line number Diff line change
Expand Up @@ -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" .}}
Original file line number Diff line number Diff line change
Expand Up @@ -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" .}}
42 changes: 42 additions & 0 deletions x-pack/elastic-agent/_meta/config/providers.yml.tmpl
Original file line number Diff line number Diff line change
@@ -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: true
# 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
24 changes: 16 additions & 8 deletions x-pack/elastic-agent/docs/elastic-agent-providers.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]]
Expand Down
44 changes: 44 additions & 0 deletions x-pack/elastic-agent/elastic-agent.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: true
# 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

44 changes: 44 additions & 0 deletions x-pack/elastic-agent/elastic-agent.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: true
# 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


44 changes: 44 additions & 0 deletions x-pack/elastic-agent/elastic-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: true
# 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


0 comments on commit 4b30d9a

Please sign in to comment.