Agent Environment Variables

Agent Environment Variables

For Agent v5, reference the Docker Agent GitHub repo.

Overview

For Agent v6, most of the configuration options in the Agent’s main configuration file (datadog.yaml) can be set through environment variables.

Recommendations

As a best practice, Datadog recommends using unified service tagging when assigning tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: env, service, and version. To learn how to configure your environment with unified tagging, refer to the dedicated unified service tagging documentation.

General use

In general, use the following rules:

  • Option names should be uppercase with the DD_ prefix: hostname -> DD_HOSTNAME

  • List values should be separated by spaces (Include rules support regexes, and are defined as a list of comma-separated strings):

       container_include:
         - "image:cp-kafka"
         - "image:k8szk"
       # DD_CONTAINER_INCLUDE="image:cp-kafka image:k8szk"
    
  • The nesting of config options with predefined keys should be separated with an underscore:

       cluster_agent:
         cmd_port: 5005
       # DD_CLUSTER_AGENT_CMD_PORT=5005
    
  • The nesting of config options with user-defined keys must be JSON-formatted:

       docker_env_as_tags:
         ENVVAR_NAME: tag_name
       # DD_DOCKER_ENV_AS_TAGS='{"ENVVAR_NAME": "tag_name"}'
    

Note: Specifying a nested option with an environment variable overrides all the nested options specified under the config option. The exception to this rule is the proxy config option. Reference the Agent proxy documentation for more details.

Exceptions

  • Not all datadog.yaml options are available with environment variables. Refer to config.go in the Datadog Agent GitHub repo. Options with environment variables start with config.BindEnv*.

  • Component-specific environment variables not listed in config.go may also be supported.

Further Reading