File contents PostHog logs for Next.js
This skill helps you add PostHog log ingestion to Next.js applications.
Reference files
references/nextjs.md - Next.js logs installation - docs
references/start-here.md - Getting started with logs - docs
references/search.md - Search logs - docs
references/best-practices.md - Logging best practices - docs
references/troubleshooting.md - Logs troubleshooting - docs
references/link-session-replay.md - Link session replay - docs
references/debug-logs-mcp.md - Debug logs with mcp - docs
Consult the documentation for API details and framework-specific patterns.
Key principles
Environment variables : Always use environment variables for PostHog keys and OpenTelemetry endpoints. Never hardcode them.
Minimal changes : Add log export alongside existing logging. Don't replace or restructure existing logging code.
OpenTelemetry : PostHog logs use the OpenTelemetry protocol. Configure an OTLP exporter pointed at PostHog's ingest endpoint.
Structured logging : Prefer structured log formats with key-value properties over plain text messages.
Framework guidelines
For Next.js 15.3+, initialize PostHog in instrumentation-client.ts for the simplest setup
1 --- 2 name: logs-nextjs 3 description: PostHog logs for Next.js 4 --- 5 6 # PostHog logs for Next.js 7 8 This skill helps you add PostHog log ingestion to Next.js applications. 9 10 ## Reference files 11 12 - `references/nextjs.md` - Next.js logs installation - docs 13 - `references/start-here.md` - Getting started with logs - docs 14 - `references/search.md` - Search logs - docs 15 - `references/best-practices.md` - Logging best practices - docs 16 - `references/troubleshooting.md` - Logs troubleshooting - docs 17 - `references/link-session-replay.md` - Link session replay - docs 18 - `references/debug-logs-mcp.md` - Debug logs with mcp - docs 19 20 Consult the documentation for API details and framework-specific patterns. 21 22 ## Key principles 23 24 - **Environment variables**: Always use environment variables for PostHog keys and OpenTelemetry endpoints. Never hardcode them. 25 - **Minimal changes**: Add log export alongside existing logging. Don't replace or restructure existing logging code. 26 - **OpenTelemetry**: PostHog logs use the OpenTelemetry protocol. Configure an OTLP exporter pointed at PostHog's ingest endpoint. 27 - **Structured logging**: Prefer structured log formats with key-value properties over plain text messages. 28 29 ## Framework guidelines 30 31 - For Next.js 15.3+, initialize PostHog in instrumentation-client.ts for the simplest setup
posthog/skills/tree/main/skills/posthog/all/skills/logs-nextjs commit 6e0cd00513
Frequently asked questions How do I install the Logs Nextjs skill? Run npx skillmds@latest add posthog-skills/logs-nextjs in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Logs Nextjs skill do? PostHog logs for Next.js It is listed under Web & Frontend on SkillMD.
Is Logs Nextjs safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Logs Nextjs? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Logs Nextjs free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Logs Nextjs? posthog (@posthog-skills) published this skill. Their other Agent Skills are listed on their SkillMD profile.