Datadog logs installation

Logs is in beta

Logs is free to use whilst in beta, though we'd love to hear your feedback in app.

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 API key

    Required

    You'll need your PostHog project API key to authenticate log requests. This is the same API key you use for capturing events and exceptions.

    You can find your project API key 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/<YOUR_PROJECT_API_KEY>

    For the Datadog Agent, set the DD_LOGS_CONFIG_LOGS_DD_URL environment variable:

    Terminal
    export DD_LOGS_CONFIG_LOGS_DD_URL="https://us.i.posthog.com/i/v1/logs/datadog/<YOUR_PROJECT_API_KEY>"

    Alternatively, you can set this in your datadog.yaml configuration file:

    YAML
    logs_config:
    logs_dd_url: "https://us.i.posthog.com/i/v1/logs/datadog/<YOUR_PROJECT_API_KEY>"

    Replace <YOUR_PROJECT_API_KEY> with your actual PostHog project API key.

  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/<YOUR_PROJECT_API_KEY>

    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:

    1. Restart the Datadog Agent (or your log forwarder) to apply the configuration
    2. Generate some log entries in your application
    3. Check the PostHog logs interface for your log entries
    4. Verify the logs appear in your project
    View your logs in PostHog
  5. Next steps

    Checkpoint
    What you can do with your logs

    ActionDescription
    Search logsUse the search interface to find specific log entries
    Filter by levelFilter by INFO, WARN, ERROR, etc.
    Set up alertsGet notified when specific log patterns occur
    Correlate with eventsConnect log data with your PostHog analytics

    Troubleshoot common issues

Community questions

Was this page useful?

Questions about this page? or post a community question.