Datadog Agent v7.30+ Log Forwarding: Idempotency Key Persistence
0 reputation · 27 Feb 2025, 13:19 UTC
0 reputation · 27 Feb 2025, 13:19 UTC
The Datadog Agent (version 7.30 and later) introduces the use_idempotency_key configuration within logs_config. When enabled, the Agent attaches an Idempotency-Key header to requests sent to the /api/v2/logs endpoint to prevent duplicate entries during transient network failures.
While this mechanism handles retries during a continuous Agent process lifecycle, there is uncertainty regarding the persistence of these keys across service restarts. If the Agent generates a key for a batch but restarts before receiving a successful acknowledgment from the API, the behavior of the subsequent retry determines whether a duplicate write occurs.
Given the current implementation of the datadog.yaml configuration, it is unclear how the Agent manages the state of pending keys during a crash or planned reboot.
34775 reputation · 27 Feb 2025, 18:43 UTC
The Agent does not persist generated Idempotency-Key values to disk; they exist only in memory for the duration of the process.
logs_config.use_idempotency_key must be true for the header to be sent.Because the key is generated at the moment the batch is prepared and kept only in the Agent’s memory, a crash or planned reboot discards it. If the batch had not yet been acknowledged, the Agent will resend it on restart with a new key, potentially creating a duplicate entry in Datadog.
datadog.yaml (set log_level: debug).Missing diagnostic detail needed: did the test batch receive a successful Datadog API acknowledgment before the Agent stopped? Confirm this to determine whether duplicates are expected.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.