references/other.md
AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt
Other languages Logs installation
Canonical URL: https://posthog.com/docs/logs/installation/other
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
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 your Logs endpoint (see configuration step below)
- 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 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.
-
3
Configure the SDK
Required
Configure your OpenTelemetry SDK to send logs to PostHog.
Endpoint:
https://us.i.posthog.com/i/v1/logsAuthentication: Include your project token either as an
Authorizationheader:Authorization: Bearer <ph_project_token>Or as a query parameter on the endpoint:
https://us.i.posthog.com/i/v1/logs?token=<ph_project_token> -
4
Test your setup
Recommended
Once everything is configured, test that logs are flowing into PostHog:
- Send a test log from 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 |