Serverless Agent configuration

Overview

The Agent’s main configuration file is datadog.yaml. For the serverless Agent, datadog.yaml configuration options are passed in with environment variables. The environment variables are usually named as their config options in capital snake case. For example, set your Datadog API key as DD_API_KEY.

Basic configuration

Environment VariableDescription
DD_API_KEYThe environment variable with your Datadog API key, in plaintext. One key environment variable is required. See serverless CLI environment variables.
DD_KMS_API_KEYThe environment variable with your Datadog API key, using KMS. One key environment variable is required. See serverless CLI environment variables.
DD_API_KEY_SECRET_ARNThe environment variable with your Datadog API key, using an AWS Secrets Manager secret. One key environment variable is required. See serverless CLI environment variables.
DD_LOG_LEVELSet the level for the Datadog Agent log.
DD_SERVERLESS_FLUSH_STRATEGYDatadog Agent flushing strategy. Values permitted are end or periodically[,milliseconds]. For example, DD_SERVERLESS_FLUSH_STRATEGY=periodically,100 flushes every 100ms.
DD_ENVSets the global tag env tag for all data emitted.
DD_TAGSHost tags separated by spaces. For example: simple-tag-0 tag-key-1:tag-value-1.
DD_SITEDestination site for your metrics, traces, and logs. Set your Datadog site to: . Defaults to datadoghq.com.
DD_DD_URLOptional setting to override the URL for metric submission.
DD_URLAlias for DD_DD_URL. Ignored if DD_DD_URL is already set.
DD_TRACE_ENABLEDEnables trace collection. Defaults to true. For more information about trace collection environment variables, see Library Configuration.
DD_TAGSList of tags. Attached in-app to every metric, event, log, trace, and service check emitted by this Agent.
DD_TAG_VALUE_SPLIT_SEPARATORSplit tag values according to a given separator. Only applies to host tags, and tags coming from container integrations. It does not apply to tags on DogStatsD metrics, or tags collected by other integrations.

Log collection configuration

Environment VariableDescription
DD_LOGS_ENABLEDSet to true to enable Datadog Agent log collection.
DD_LOGS_CONFIG_LOGS_DD_URLDefine the endpoint and port to hit when using a proxy for logs. Because logs are forwarded in TCP, the proxy must be able to handle TCP connections. String in the format <ENDPOINT>:<PORT>.
DD_LOGS_CONFIG_LOGS_NO_SSLDisable the SSL encryption. This parameter should only be used when logs are forwarded locally to a proxy. It is highly recommended to then handle the SSL encryption on the proxy side.
DD_LOGS_CONFIG_PROCESSING_RULESGlobal processing rules that are applied to all logs. The available rules are exclude_at_match, include_at_match, and mask_sequences. For more information, see Global Processing Rules.
DD_LOGS_CONFIG_FORCE_USE_HTTPBy default, the Agent sends logs in HTTPS batches to port 443 if HTTPS connectivity can be established at Agent startup, and falls back to TCP otherwise. Set this parameter to true to always send logs with HTTPS (recommended).
DD_LOGS_FORCE_USE_TCPBy default, logs are sent through HTTPS if possible. Set this parameter to true to always send logs via TCP. If DD_LOGS_CONFIG_FORCE_USE_HTTP is set to true, this parameter is ignored.
DD_LOGS_CONFIG_USE_COMPRESSIONThis parameter is available when sending logs with HTTPS. If set to true, the Agent compresses logs before sending them.
DD_LOGS_CONFIG_COMPRESSION_LEVELThis parameter accepts values from 0 (no compression) to 9 (maximum compression but higher resource usage). Only takes effect if DD_LOGS_CONFIG_USE_COMPRESSION is set to true.
DD_LOGS_CONFIG_BATCH_WAITThe maximum time (in seconds) the Datadog Agent waits to fill each batch of logs before sending. Default to 5.
DD_LOGS_CONFIG_OPEN_FILES_LIMITThe maximum number of files that can be tailed in parallel. Default is 500.
DD_LOGS_CONFIG_FILE_WILDCARD_SELECTION_MODEThe strategy used to prioritize wildcard matches if they exceed the open file limit. Available values are by_name and by_modification_time.
DD_LOGS_CONFIG_LAMBDA_LOGS_TYPESource of logs to export. Value permitted is a space separated list of function, platform, extension. Default is everything.

APM configuration

Environment VariableDescription
DD_APM_ENABLEDSet to true to enable the APM Agent. Defaults to true.
DD_APM_ENVThe environment tag that traces are tagged with. If this variable is not set, the value is inherited from DD_ENV. If DD_ENV is not set, then this value is inherited from the env: tag set in DD_TAGS.
DD_APM_RECEIVER_PORTThe port that the trace receiver listens on. Set to 0 to disable the HTTP receiver. Default: 8126.
DD_APM_RECEIVER_SOCKETAccept traces through Unix Domain Sockets. It is off by default. When set, it must point to a valid socket file.
DD_APM_DD_URLDefine the endpoint and port to hit when using a proxy for APM. String in the format <ENDPOINT>:<PORT>. Because traces are forwarded in TCP, the proxy must be able to handle TCP connections.
DD_APM_REPLACE_TAGSDefines a set of rules to replace or remove certain tags that contain potentially sensitive information.
DD_APM_IGNORE_RESOURCESAn exclusion list of regular expressions. Any trace with a resource name that matches one of these expressions is ignored. Use a comma-separated list and surround each entry with double quotes. For example: "^foo$", "bar$"

Advanced networking configuration

Environment VariableDescription
DD_SKIP_SSL_VALIDATIONSet this option to true to tell the Agent to skip validation of SSL/TLS certificates. Defaults to false.
DD_MIN_TLS_VERSIONThis option defines the minimum TLS version for submitting data to the Datadog intake specified in DD_SITE or DD_URL. Possible values are: tlsv1.0, tlsv1.1, tlsv1.2, or tlsv1.3. Values are case-insensitive. Defaults to tlsv1.2.

Proxy settings

Env VariableDescription
DD_PROXY_HTTPAn HTTP URL to use as a proxy for http requests.
DD_PROXY_HTTPSAn HTTPS URL to use as a proxy for https requests.
DD_PROXY_NO_PROXYA space-separated list of URLs for which no proxy should be used.

For more information about proxy settings, see the Agent v6 Proxy documentation.

DogStatsD (custom metrics)

Send custom metrics with the StatsD protocol:

Env VariableDescription
DD_DOGSTATSD_NON_LOCAL_TRAFFICListen to DogStatsD packets from other containers (required to send custom metrics).
DD_DOGSTATSD_SOCKETPath to the Unix socket to listen to. Must be in a rw mounted volume.
DD_DOGSTATSD_ORIGIN_DETECTIONEnable container detection and tagging for Unix socket metrics.
DD_DOGSTATSD_TAGSSpace-separated list of additional tags to append to all metrics, events, and service checks received by this DogStatsD server. For example: "env:golden group:retrievers".
DD_USE_DOGSTATSDEnable or disable sending custom metrics from the DogStatsD library.
DD_DOGSTATSD_PORTOverride the Agent DogStatsD port.
DD_BIND_HOSTThe host to listen on for DogStatsD and traces. This is ignored by APM when apm_config.apm_non_local_traffic is enabled and ignored by DogStatsD when dogstatsd_non_local_traffic is enabled. The Trace Agent uses this host to send metrics to.
Note: The localhost default value is invalid in IPv6 environments where DogStatsD listens on ::1. To solve this problem, ensure DogStatsD is listening on IPv4 by setting this value to 127.0.0.1.
DD_DOGSTATSD_ORIGIN_DETECTION_CLIENTWhen set to true, the Agent uses a client-provided container ID to enrich the metrics, events, and service checks with container tags.
Note: This requires using a client compatible with DogStatsD protocol version 1.2.
DD_DOGSTATSD_BUFFER_SIZEThe buffer size used to receive StatsD packets, in bytes.
DD_DOGSTATSD_STATS_ENABLEPublish DogStatsD’s internal stats as Go expvars.
DD_DOGSTATSD_QUEUE_SIZEConfigure the internal queue size of the DogStatsD server. Reducing the size of this queue reduces the maximum memory usage of the DogStatsD server, but can also increase the number of packet drops.
DD_DOGSTATSD_STATS_BUFFERSet how many items should be in the DogStatsD’s stats circular buffer.
DD_DOGSTATSD_STATS_PORTThe port for the Go expvar server.
DD_DOGSTATSD_SO_RCVBUFPOSIX systems only: Sets the number of bytes allocated to DogStatsD’s socket receive buffer. By default, the OS sets this value. Use this variable to increase the size of the buffer without altering the OS default value. The maximum accepted value depends on the OS.
DD_DOGSTATSD_METRICS_STATS_ENABLEWhen set to true, DogStatsD collects basic statistics (count/last seen) about the metrics it processed. Use the Agent command dogstatsd-stats to see these statistics.
DD_DOGSTATSD_NO_AGGREGATION_PIPELINEEnable the no-aggregation pipeline in DogStatsD. This pipeline receives metrics with timestamps and forwards them to the intake without extra processing, except for tagging.
DD_DOGSTATSD_NO_AGGREGATION_PIPELINE_BATCH_SIZEHow many metrics maximum in payloads sent by the no-aggregation pipeline to the intake.
DD_STATSD_FORWARD_HOSTForward every packet received by the DogStatsD server to another StatsD server. Make sure that forwarded packets are regular StatsD packets and not DogStatsD packets, as your other StatsD server might not be able to handle them.
DD_STATSD_FORWARD_PORTPort to forward StatsD packets to.
DD_STATSD_METRIC_NAMESPACESet a namespace for all StatsD metrics coming from this host. Each metric received is prefixed with the namespace before it is sent to Datadog.