Go logs installation
Logs is in beta
Logs is free to use whilst in beta, though we'd love to hear your feedback in app.
- 1
Install OpenTelemetry packages
RequiredTerminal - 2
Get your project API key
RequiredYou'll need your PostHog project API key to authenticate log requests. This is the same key you use for capturing events and exceptions with the PostHog SDK.
Important: Use your project API key which starts with
phc_. Do not use a personal API key (which starts withphx_).You can find your project API key in Project Settings under "Project Variables" → "Project API key".
- 3
Configure the SDK
RequiredSet up the OpenTelemetry SDK to send logs to PostHog.
GoAlternatively, you can pass the API key as a query parameter by modifying the URL path:
Go - 4
Use OpenTelemetry logging
RequiredNow you can start logging with OpenTelemetry:
Go - 5
Next steps
CheckpointWhat you can do with your logsAction Description Search logs Use the search interface to find specific log entries Filter by level Filter by INFO,WARN,ERROR, etc.Set up alerts Get notified when specific log patterns occur Correlate with events Connect log data with your PostHog analytics Link session replay Connect logs to users and session replays by passing posthogDistinctIdandsessionId