Other languages logs installation

Logs is in alpha

Logs is currently in beta. To gain access, opt-in to the beta from your feature previews menu. Logs is free to use during beta, though we'd love to hear your feedback in app.

PostHog logs works with any OpenTelemetry-compatible client. Check the OpenTelemetry documentation for your specific language or framework.

  1. Install OpenTelemetry packages

    Required

    The key requirements are:

    • Use OTLP (OpenTelemetry Protocol) for log export over HTTP
    • Send logs to https://us.i.posthog.com/i/v1/logs (or your self-hosted endpoint)
    • Include your project token in the Authorization header or as a ?token= query parameter

    Find the OpenTelemetry SDK for your language in the official registry.

  2. Get your project token

    Required

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

    You can find your project token in Project Settings.

  3. Configure the SDK

    Required

    Configure your OpenTelemetry SDK to send logs to PostHog:

    • Endpoint: https://us.i.posthog.com/i/v1/logs
    • Authentication: Include your project token either:
      • In the Authorization header: Bearer {your-project-token}
      • As a query parameter: ?token={your-project-token}
  4. Test your setup

    Recommended

    Once everything is configured, test that logs are flowing into PostHog:

    1. Send a test log from your application
    2. Check the PostHog logs interface for your log entries
    3. 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.