Getting Started with Datadog Log Collection - Where conf.d Trips You Up

This article sorts out the order of checks when logs do not arrive, the role of each key in the logs: block of conf.d (type / path / source / service), the log_processing_rules that reduce volume on the Agent side before sending, and the snags around multi-line logs, character encodings, and permissions. Processing after arrival is left to the glossary pages.

The order of checks when logs do not arrive is fixed

There are three routes by which logs enter Datadog, the Agent / cloud integrations / the API, and the overall picture is left to the Log Management explanation. This article covers only the route through the Agent installed on a host. The official troubleshooting guide lists four configuration checkpoints it says are worth confirming carefully, and if you go through them in order, the majority of causes are found here (as of September 2026; source: Log Collection Troubleshooting Guide).

  • 1. api_key is present in datadog.yaml
  • 2. In the same file, logs_enabled: true is set (the default is false)
  • 3. There is at least one YAML file under conf.d/ containing a logs: section (without one, the Agent collects nothing)
  • 4. There are no YAML syntax errors (the official docs recommend checking with a validation tool)
  • 5. You restarted the Agent after changing the configuration
  • 6. New lines were written after the Agent started reading (lines written before startup are not collected)
Source: Log Collection Troubleshooting Guide (Configuration issues / Restart the Agent / No new logs have been written)

The sixth is an easily overlooked behavior: the Agent collects only lines written after the point at which it started reading. If you test on a quiet log file, it looks like "the configuration is correct but nothing arrives," so append one line when checking. If you still cannot tell, look at the Agent's own log.

sudo grep -i error /var/log/datadog/agent.log

Enable it in datadog.yaml, and write the targets in conf.d

Log collection configuration is split across two places. The switch is logs_enabled in datadog.yaml, or DD_LOGS_ENABLED=true as an environment variable (as of September 2026; source: Host Agent Log collection). What to collect is written in a logs: block in a file <CUSTOM_LOG_SOURCE>.d/conf.yaml that you create under conf.d/. For the locations and the division of roles, see the datadog.yaml glossary page. The minimal conf.yaml takes this form.

logs:
  - type: file
    path: "<PATH_LOG_FILE>/<LOG_FILE_NAME>.log"
    service: "<APP_NAME>"
    source: "<SOURCE>"

After a restart, if <CUSTOM_LOG_SOURCE> appears under Checks in agent status, it has been loaded.

What source and service are for

The keys in the logs: block fall into four required ones and optional ones (as of September 2026; source: Host Agent Log collection).

The main keys of the logs: block (from the parameter table in Host Agent Log collection)
KeyRequiredRole, and what happens if you do not decide it
typeRequiredThe input type. file / tcp / udp / journald / windows_event / docker
pathRequired for file / journaldThe file to read. Wildcards allowed; exclude with exclude_paths
serviceRequiredThe name of the service emitting the log. If you have APM installed, it must match that service name or the logs will not link to traces
sourceRequiredWhich integration emitted the log. Matching it to the integration name causes the standard pipeline for that integration to apply automatically
tagsOptionalTags attached to each log. Align common axes such as env
encodingOptionalDefault is UTF-8. shift-jis can be specified from Agent 6.34 / 7.34 onward
start_positionOptionalThe position to start reading from
Sources: Host Agent Log collection (List of all available parameters) and Advanced Log Collection Configurations (Log file encodings)

Among these, the ones hard to fix later are source and service. source is the key to the automatic application of log pipelines; if you enter an integration name such as postgresql, the parsing for that integration applies from the start. service, by being aligned with the APM service name, lets you move back and forth between logs and traces, and logs from any period in which they were not aligned lose the handle for cross-referencing.

Reduce before sending - log_processing_rules on the Agent side

There are two places to reduce log volume. log_processing_rules on the Agent side drop lines before they leave the host, so both transfer volume and ingested volume fall; exclusion filters and log indexes on the Datadog side act after arrival, so ingestion has already happened (as of September 2026; source: Advanced Log Collection Configurations).

Types of Agent-side log_processing_rules
typeEffectWhen to use
exclude_at_matchDoes not send lines matching the patternDropping health check or debug lines
include_at_matchSends only matching linesYou want only lines containing a specific string
mask_sequencesReplaces the matched portion with the value of replace_placeholderMasking card numbers and the like before they leave
multi_lineTreats a line starting with the pattern as the beginning of a new log and bundles the restMaking a stack trace a single log
Source: Advanced Log Collection Configurations (Filter logs / Scrub sensitive data / Manually aggregate multi-line logs)

Exclusions are written inside each item under logs:.

    log_processing_rules:
      - type: exclude_at_match
        name: exclude_healthcheck
        pattern: /healthz

pattern is a regular expression. mask_sequences, which masks before sending, is the place on the Agent side where data can be removed before it reaches Datadog (for a pipeline product, Observability Pipelines).

Decide on multi-line logs and character encoding first

Multi-line logs are a common snag. By default the Agent treats one line as one log, so a Java stack trace arrives broken up line by line (as of September 2026; source: Advanced Log Collection Configurations). There are two fixes: if writing by hand, put a regular expression for "the line that begins a new log" (the official example is a date) in a multi_line rule; if there are many formats, add auto_multi_line_detection: true under logs_config in datadog.yaml and leave it to automatic detection (source: Host Agent Log collection).

Three defaults and settings that affect how lines are read
ItemDefaultSetting
Multi-line1 line = 1 logA multi_line rule, or auto_multi_line_detection: true
Character encodingUTF-8utf-16-le / utf-16-be (Agent 6.23 / 7.23 onward) or shift-jis (6.34 / 7.34 onward) in encoding. Unsupported values are ignored and treated as UTF-8
Line endingOnly lines ending in a newline (\n or \r\n) are sentA line without a newline is held by the Agent and not sent
Sources: Advanced Log Collection Configurations (Manually aggregate multi-line logs / Log file encodings) and Host Agent Log collection (note under Custom log collection)

Shift-JIS files emitted by Windows-based applications are read as UTF-8 unless the single encoding line is present, and arrive as lines with the Japanese portions garbled. The character encoding of the target file is something to confirm before writing conf.yaml.

Permissions, containers, and limits on the receiving side

The Agent does not run as root; it reads as the user datadog-agent on Linux and macOS and ddagentuser on Windows (as of September 2026; source: Log Collection Troubleshooting Guide). If that user cannot read the file, a "file does not exist" type of error appears in agent status. Container logs are specified not through the conf.d in this article but through labels on Docker and through values and annotations on Kubernetes, so they are left to the Docker article and the Kubernetes article. Logs from AWS services take the Datadog Forwarder or Data Firehose route, which the AWS integration article handles.

Limits on the receiving side (official statements as of September 2026)
ItemLimit
Tags per logUp to 100, each tag up to 256 characters
Attributes when converted to JSONFewer than 2,048. Keys under 50 characters, nesting under 20 levels
TimestampLogs with a time earlier than 18 hours ago are not accepted
Attributes with null valuesNot retained
DestinationThe HTTPS endpoint (443) for each site. The Agent uses an encrypted route
Source: Log Collection and Integrations (Limitations / Logging endpoints)

The timestamp limit matters when bulk-loading old logs. Because lines earlier than 18 hours ago are not accepted, past data requires a different method.

What you should see when it has succeeded, and what to decide next

Success is judged in three stages. Your <CUSTOM_LOG_SOURCE> appears under Checks in agent status with no warnings. After a new line is written to the target file, that log can be found in Log Explorer from the source or service facet. And for logs whose source is an integration name, the attributes for that integration are attached (as of September 2026; source: Host Agent Log collection).

  • 1. The configuration name appears under Checks in agent status
  • 2. After writing a new line, it is found via the source / service facet in Log Explorer
  • 3. The attributes of the standard pipeline matching the source are attached
  • 4. If there are unexpectedly many or missing lines, suspect Agent-side exclusions or permissions
Sources: Host Agent Log collection (Custom log collection) and Log Collection Troubleshooting Guide (Permission issues tailing log files)

Once logs start arriving, the next thing to decide is the volume design. Because the bill is determined by how many GB you send and how much you keep in indexes, get a grip on the counting rules in the log pricing article, then combine Agent-side exclusions with post-arrival exclusion filters. If you have not yet installed the Agent on the host, start from the Linux installation article.

References

Share