Configure providers for standalone Elastic Agents

edit

Configure providers for standalone Elastic Agents

edit

Providers supply the key-value pairs that are used for variable substitution and conditionals. Each provider’s keys are automatically prefixed with the name of the provider in the context of the Elastic Agent.

For example, a provider named foo provides {"key1": "value1", "key2": "value2"}, the key-value pairs are placed in {"foo" : {"key1": "value1", "key2": "value2"}}. To reference the keys, use {{foo.key1}} and {{foo.key2}}.

Provider configuration

edit

The provider configuration is specified under the top-level providers key in the elastic-agent.yml configuration. All registered providers are enabled by default. If a provider cannot connect, no mappings are produced.

The following example shows two providers (local and local_dynamic) that supply custom keys:

providers:
  local:
    vars:
      foo: bar
  local_dynamic:
    vars:
      - item: key1
      - item: key2

Explicitly disable a provider by setting enabled: false. All providers are prefixed without name collisions. The name of the provider is in the key in the configuration.

providers:
  docker:
    enabled: false

Elastic Agent supports two broad types of providers: context and dynamic.

Context providers
edit

Context providers give the current context of the running Elastic Agent, for example, agent information (ID, version), host information (hostname, IP addresses), and environment information (environment variables).

They can only provide a single key-value mapping. Think of them as singletons; an update of a key-value mapping results in a re-evaluation of the entire configuration. These providers are normally very static, but not required. A value can change which results in re-evaluation.

Context providers use the Elastic Common Schema (ECS) naming to ensure consistency and understanding throughout documentation and projects.

Elastic Agent supports the following context providers:

Dynamic Providers
edit

Dynamic providers give an array of multiple key-value mappings. Each key-value mapping is combined with the previous context provider’s key and value mapping which provides a new unique mapping that is used to generate a configuration.

Elastic Agent supports the following context providers:

Disabling Providers By Default
edit

All registered providers are enabled by default.

Disable all providers by default and only enable explicitly configured providers by setting agent.providers.initial_default: false.

agent.providers.initial_default: false
providers:
  docker:
    enabled: true