references/datadog.md
AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
Datadog Logs installation
Canonical URL: https://posthog.com/docs/logs/installation/datadog
Cloud region: This page uses US Cloud hosts. For an EU Cloud project, use
https://eu.i.posthog.cominstead ofhttps://us.i.posthog.com(ingestion host), and usehttps://eu.posthog.cominstead ofhttps://app.posthog.com(app host for links).
On this page
- Get your project token
- Configure Datadog Agent
- Other Datadog log exporters
- Test your setup
- Next steps
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
Required
You'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
Required
Set the Datadog logs URL to point to PostHog's Datadog-compatible endpoint. The endpoint format is:
https://us.i.posthog.com/i/v1/logs/datadog/<ph_project_token>For the Datadog Agent, set the
DD_LOGS_CONFIG_LOGS_DD_URLenvironment variable:export DD_LOGS_CONFIG_LOGS_DD_URL="https://us.i.posthog.com/i/v1/logs/datadog/<ph_project_token>"Alternatively, you can set this in your
datadog.yamlconfiguration file:logs_config: logs_dd_url: "https://us.i.posthog.com/i/v1/logs/datadog/<ph_project_token>" -
3
Other Datadog log exporters
Optional
If you're using other Datadog log exporters or forwarders, configure them to send logs to the same endpoint:
https://us.i.posthog.com/i/v1/logs/datadog/<ph_project_token>The endpoint accepts logs in the standard Datadog log format, so existing integrations should work without additional changes.
-
4
Test your setup
Recommended
Once everything is configured, test that logs are flowing into PostHog:
- Restart the Datadog Agent (or your log forwarder) to apply the configuration
- Generate some log entries in your application
- Check the PostHog Logs interface for your log entries
- Verify the logs appear in your project
-
Next steps
Checkpoint
What you can do with your logs
| Action | 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 passingposthogDistinctIdandsessionId| | Link 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 |