opensre integrations setup posthog or POSTHOG_* environment variables.
Looking for agent tools during investigations (analytics, feature flags, HogQL)? Use PostHog (MCP) with
opensre integrations setup posthog_mcp.PostHog in OpenSRE — quick guide
Prerequisites
- A PostHog account (US, EU, or self-hosted)
- Your PostHog project ID
- A personal API key with read access to that project — see PostHog’s personal API keys docs
Setup
Option 1: Interactive CLI
- Project ID — from PostHog project settings
- Personal API key (
phx_...) — Personal API keys with read access - API base URL — defaults to US SaaS (
https://us.i.posthog.com); usehttps://eu.i.posthog.comfor EU
.env.
Option 2: Environment variables
Add credentials directly to your.env file:
Verify
After saving your.env, confirm OpenSRE can reach your PostHog project:
PostHog validated.
For the MCP integration, use opensre integrations verify posthog_mcp instead.
Troubleshooting
Security
- Use a dedicated personal API key with the minimum read permissions needed
- Store credentials in environment variables or a secret manager — not in source code
- Rotate keys periodically