Subchapter 49.15
references/start-here.mdMarkdown8 KBView on GitHub
PostHog Logs works with any OpenTelemetry client. No PostHog-specific packages required. Use the OTel SDKs you already have, point them at PostHog’s HTTP endpoint, and drop in your project token.
On the frontend, our JavaScript web SDK (opens in a new tab), React Native SDK (opens in a new tab), iOS SDK (opens in a new tab), and Android SDK (opens in a new tab) include first-class logging support.
Follow the guides below to set up your logging client:
PostHog ingests logs in the same pattern as OTel’s structured logging model: resource attributes, log attributes, and trace context.
Enrich your logs with granular detail and business context for INFO, DEBUG, WARN, and ERROR log levels.
Python
PostHog AI
import logging
# Configure logging to use OpenTelemetry
logging.basicConfig(level=logging.INFO)
logging.getLogger().addHandler(LoggingHandler())
# Use standard Python logging
logger = logging.getLogger("my-app")
logger.info("User action", extra={"userId": "123", "action": "login"})
logger.warning("Deprecated API used", extra={"endpoint": "/old-api"})
logger.error("Database connection failed", extra={"error": "Connection timeout"})Once your logs are flowing into PostHog, you can:


Get notified when your logs match specific conditions. Create alerts to:
Configure alerting rules in your project settings to stay on top of issues as they happen.
Connect the PostHog MCP server and your AI agent can query logs directly. Use Cursor, Claude Code, or any MCP-compatible tool.
Your coding agent pulls the relevant logs it needs to debug and build faster without switching workflows.
You can also ask PostHog AI (opens in a new tab) to search and analyze your logs.


Try out these prompts:
With PostHog, your logs live alongside your Product Analytics (opens in a new tab), Session Replays (opens in a new tab), and Error Tracking (opens in a new tab), so you can go from a log line to a user’s session to the flag variant they were on without switching tools.
Log events in PostHog can be connected to the session and user who triggered them. Jump from a log line to a session replay in one click.


Turn log patterns into trends, funnels, and retention insights. Know which logged errors actually hurt user retention vs. which are just noise.


Logs with $exception events become issues you can assign, resolve, and alert on. No separate error tracking tool needed.


PostHog’s Logs is built to be cost-effective by default, with a generous free tier and transparent usage-based pricing. Since we don’t charge per seat, more than 90% of companies use PostHog for free.
That’s it! You’re ready to start integrating.
1/7
Use your logging client RequiredSend context-rich logs RequiredSearch and analyze your logs RequiredSet up alerts RecommendedUse MCP and AI to debug RecommendedIntegrate your product data RecommendedUse for free Free 50 GB/mo
Use your logging client
Required
Ask a question
HelpfulCould be better