Subchapter 49.11
references/other.mdMarkdown3 KBView on GitHub
PostHog Logs works with any OpenTelemetry-compatible client. Check the OpenTelemetry documentation for your specific language or framework.
1
Required
The key requirements are:
?token= query parameterFind the OpenTelemetry SDK for your language in the official registry (opens in a new tab).
2
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 API key (which starts withphx_).
You can find your project token in Project Settings (opens in a new tab).
3
Required
Configure your OpenTelemetry SDK to send logs to PostHog.
Endpoint:
PostHog AI
https://us.i.posthog.com/i/v1/logsAuthentication: Include your project token either as an Authorization header:
PostHog AI
Authorization: Bearer <ph_project_token>Or as a query parameter on the endpoint:
PostHog AI
https://us.i.posthog.com/i/v1/logs?token=<ph_project_token>4
Recommended
Once everything is configured, test that logs are flowing into PostHog:
Checkpoint
What you can do with your logs
| Action | Description |
|---|---|
| Why you need logs (opens in a new tab) | What logs show you that nothing else does |
| Search logs (opens in a new tab) | Use the search interface to find specific log entries |
| Filter by level | Filter by INFO, WARN, ERROR, etc. |
| Link session replay |
Ask a question
HelpfulCould be better
| Connect logs to users and session replays by passing posthogDistinctId and sessionId |
| Link logs to a person (opens in a new tab) | Surface every log emitted on behalf of a user on their PostHog person profile |
| Logging best practices (opens in a new tab) | Learn what to log, how to structure logs, and patterns that make logs useful in production |