logs-python

Send structured Python logs to PostHog via OpenTelemetry OTLP exporter.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill logs-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logs-python
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/all/skills/logs-python
Command: npx skills add https://github.com/PostHog/skills --skill logs-python

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PostHog logs for Python helps you add PostHog log ingestion to Python applications.

Core Features & Use Cases

  • OpenTelemetry-based logging integration with PostHog, including configuring an OTLP exporter and emitting structured logs.
  • Enables correlation with PostHog events, sessions, and dashboards by standardizing log attributes and trace context.
  • Use Case: Attach logging to a Python service to monitor API calls, latency, and errors, and ship them to PostHog for centralized analysis.

Quick Start

Install OpenTelemetry Python packages and configure the OTLP exporter to PostHog, then start emitting structured logs as shown in the guide.

Frequently Asked Questions about logs-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I send Python application logs to PostHog using OpenTelemetry?

Send Python logs to PostHog by installing opentelemetry-api, opentelemetry-sdk, and the OTLP exporter, then configuring the exporter endpoint to PostHog and using the logging setup to emit structured logs.

Can I correlate Python service logs with PostHog events and sessions?

Yes, OpenTelemetry logging standardizes log attributes and trace context, enabling correlation with PostHog events, sessions, and dashboards for centralized analysis.

What Python packages do I need to emit structured logs via OTLP?

You need opentelemetry-api, opentelemetry-sdk, and the OTLP exporter packages to configure the endpoint to PostHog and start emitting structured logs.

Does OpenTelemetry logging for Python services help monitor API latency and errors?

Yes, attaching OpenTelemetry logging to a Python service monitors API calls, latency, and errors, shipping them to PostHog for centralized analysis.

How do I avoid PII when emitting structured logs from Python to PostHog?

Avoid PII by using the provided logging setup to emit structured logs, ensuring sensitive information is excluded before sending logs to PostHog.

What's the best way to set up centralized log ingestion for Python scripts?

The best way is using OpenTelemetry logging for Python apps, configuring an OTLP exporter to PostHog to send structured, traceable logs for centralized analysis.