logs-nextjs

Configure Next.js 15.3+ apps to emit OpenTelemetry logs to PostHog.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Captures and centralizes Next.js logs in PostHog using OpenTelemetry to improve observability and debugging.

Core Features & Use Cases

  • OpenTelemetry-based log ingestion from Next.js apps to PostHog.
  • Easy instrumentation integration for Next.js projects (including Next.js 15.3+).
  • Use case: correlate backend logs with frontend sessions via Session Replay.

Quick Start

Configure your Next.js project to emit OpenTelemetry logs to PostHog using the provided instrumentation setup.

Frequently Asked Questions about logs-nextjs

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

FAQPage Schema
How do I send Next.js application logs to PostHog using OpenTelemetry?

You can send Next.js logs to PostHog by configuring OpenTelemetry instrumentation hooks to emit structured logs via OTLP exporters, enabling centralized log ingestion and observability for your application.

What Next.js version is required for OpenTelemetry instrumentation hooks?

OpenTelemetry instrumentation hooks are supported in Next.js 15.3 and above, allowing you to configure environment-based structured logging and session replay linkage for end-to-end observability.

Can I correlate backend logs with frontend session replays in PostHog?

Yes, by instrumenting your Next.js app with OpenTelemetry logs sent to PostHog, you can correlate backend logs directly with frontend Session Replay data for improved debugging and observability.

Does this Next.js logging setup support cross-language OpenTelemetry exporters?

Yes, the instrumentation workflow includes cross-language examples for Node.js, Python, and Go, providing OTLP exporter configurations to emit structured logs to PostHog across different backend environments.

How do I configure environment-based structured logging in Next.js?

You configure environment-based structured logging by setting up the Next.js instrumentation hook with OpenTelemetry OTLP exporters, enforcing environment variables to control log ingestion and output to PostHog.