Datadog Logs installation
If you're already using Datadog to collect logs, you can forward them to PostHog by configuring your existing Datadog log exporters (like the Datadog Agent) to send logs to PostHog's Datadog-compatible endpoint.
- 1
Get your project token
RequiredYou'll need your PostHog project token to authenticate log requests. This is the same key you use for capturing events and exceptions with the PostHog SDK.
Important: Use your project token which starts with
phc_. Do not use a personal token (which starts withphx_).You can find your project token in Project Settings.
- 2
Configure Datadog Agent
RequiredSet the Datadog logs URL to point to PostHog's Datadog-compatible endpoint. The endpoint format is:
For the Datadog Agent, set the
DD_LOGS_CONFIG_LOGS_DD_URLenvironment variable:TerminalAlternatively, you can set this in your
datadog.yamlconfiguration file:YAML - 3
Dual-ship to Datadog and PostHog
OptionalTo compare PostHog and Datadog side by side, send the same logs to both at the same time. Keep
logs_dd_urlset to PostHog as shown in the previous step, then add Datadog as an additional endpoint, as described in Datadog's dual shipping docs:datadog.yamlWith
is_reliable: true, the Agent treats both endpoints equally. If one is unavailable, logs keep flowing to the other.Get a discounted trial while you testDual-shipping means you pay for the same logs twice while you compare. Contact sales to get a discounted trial period for the time you're testing.
- 4
Other Datadog log exporters
OptionalIf you're using other Datadog log exporters or forwarders, configure them to send logs to the same endpoint:
The endpoint accepts logs in the standard Datadog log format, so existing integrations should work without additional changes.
- 5
Test your setup
Recommended Next steps
CheckpointWhat you can do with your logsAction Description Why you need logs What logs show you that nothing else does Search logs Use the search interface to find specific log entries Filter by level Filter by INFO,WARN,ERROR, etc.Link session replay Connect logs to users and session replays by passing posthogDistinctIdandsessionIdLink logs to a person Surface every log emitted on behalf of a user on their PostHog person profile Logging best practices Learn what to log, how to structure logs, and patterns that make logs useful in production





