[{"data":1,"prerenderedAt":3470},["ShallowReactive",2],{"navigation_docs":3,"-integrate-adapters-cloud-posthog":529,"-integrate-adapters-cloud-posthog-surround":3465},[4,30,80,128,308,440,499],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Start","\u002Fstart","1.start",[9,14,19,24],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Why start with evlog","\u002Fstart\u002Fwhy-evlog","1.start\u002F2.why-evlog","i-lucide-rocket",{"title":20,"path":21,"stem":22,"icon":23},"Installation","\u002Fstart\u002Finstallation","1.start\u002F3.installation","i-lucide-download",{"title":25,"path":26,"stem":27,"icon":28},"Quick Start","\u002Fstart\u002Fquick-start","1.start\u002F4.quick-start","i-lucide-zap",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Learn","\u002Flearn","2.learn",[35,40,45,50,55,60,65,70,75],{"title":36,"path":37,"stem":38,"icon":39},"Overview","\u002Flearn\u002Foverview","2.learn\u002F0.overview","i-lucide-list",{"title":41,"path":42,"stem":43,"icon":44},"Simple Logging","\u002Flearn\u002Fsimple-logging","2.learn\u002F1.simple-logging","i-lucide-terminal",{"title":46,"path":47,"stem":48,"icon":49},"Wide Events","\u002Flearn\u002Fwide-events","2.learn\u002F2.wide-events","i-lucide-layers",{"title":51,"path":52,"stem":53,"icon":54},"Structured Errors","\u002Flearn\u002Fstructured-errors","2.learn\u002F3.structured-errors","i-lucide-shield-alert",{"title":56,"path":57,"stem":58,"icon":59},"Lifecycle","\u002Flearn\u002Flifecycle","2.learn\u002F4.lifecycle","i-lucide-arrow-right-left",{"title":61,"path":62,"stem":63,"icon":64},"Sampling","\u002Flearn\u002Fsampling","2.learn\u002F5.sampling","i-lucide-filter",{"title":66,"path":67,"stem":68,"icon":69},"Auto-Redaction","\u002Flearn\u002Fredaction","2.learn\u002F6.redaction","i-lucide-eye-off",{"title":71,"path":72,"stem":73,"icon":74},"Typed Fields","\u002Flearn\u002Ftyped-fields","2.learn\u002F7.typed-fields","i-simple-icons-typescript",{"title":76,"path":77,"stem":78,"icon":79},"Catalogs","\u002Flearn\u002Fcatalogs","2.learn\u002F8.catalogs","i-lucide-book-open",{"title":81,"path":82,"stem":83,"children":84,"page":29},"CLI","\u002Fcli","3.cli",[85,88,93,98,103,108,113,118,123],{"title":36,"path":86,"stem":87,"icon":44},"\u002Fcli\u002Foverview","3.cli\u002F0.overview",{"title":89,"path":90,"stem":91,"icon":92},"init","\u002Fcli\u002Finit","3.cli\u002F1.init","i-lucide-wand-sparkles",{"title":94,"path":95,"stem":96,"icon":97},"map","\u002Fcli\u002Fmap","3.cli\u002F2.map","i-lucide-radar",{"title":99,"path":100,"stem":101,"icon":102},"Rules","\u002Fcli\u002Frules","3.cli\u002F3.rules","i-lucide-list-checks",{"title":104,"path":105,"stem":106,"icon":107},"Scoring","\u002Fcli\u002Fscoring","3.cli\u002F4.scoring","i-lucide-gauge",{"title":109,"path":110,"stem":111,"icon":112},"CI","\u002Fcli\u002Fci","3.cli\u002F5.ci","i-lucide-git-pull-request",{"title":114,"path":115,"stem":116,"icon":117},"doctor","\u002Fcli\u002Fdoctor","3.cli\u002F6.doctor","i-lucide-stethoscope",{"title":119,"path":120,"stem":121,"icon":122},"telemetry","\u002Fcli\u002Ftelemetry","3.cli\u002F7.telemetry","i-lucide-bar-chart-3",{"title":124,"path":125,"stem":126,"icon":127},"agents","\u002Fcli\u002Fagents","3.cli\u002F8.agents","i-lucide-bot",{"title":129,"path":130,"stem":131,"children":132,"page":29},"Integrate","\u002Fintegrate","4.integrate",[133,137,220],{"title":36,"path":134,"stem":135,"icon":136},"\u002Fintegrate\u002Foverview","4.integrate\u002F0.overview","i-lucide-plug",{"title":138,"path":139,"stem":140,"children":141,"page":29},"Adapters","\u002Fintegrate\u002Fadapters","4.integrate\u002Fadapters",[142,145,175,200],{"title":36,"path":143,"stem":144,"icon":39},"\u002Fintegrate\u002Fadapters\u002Foverview","4.integrate\u002Fadapters\u002F01.overview",{"title":146,"path":147,"stem":148,"children":149,"page":29},"Cloud","\u002Fintegrate\u002Fadapters\u002Fcloud","4.integrate\u002Fadapters\u002Fcloud",[150,155,160,165,170],{"title":151,"path":152,"stem":153,"icon":154},"Axiom","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Faxiom","4.integrate\u002Fadapters\u002Fcloud\u002F01.axiom","i-custom-axiom",{"title":156,"path":157,"stem":158,"icon":159},"PostHog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fposthog","4.integrate\u002Fadapters\u002Fcloud\u002F02.posthog","i-simple-icons-posthog",{"title":161,"path":162,"stem":163,"icon":164},"Sentry","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fsentry","4.integrate\u002Fadapters\u002Fcloud\u002F03.sentry","i-simple-icons-sentry",{"title":166,"path":167,"stem":168,"icon":169},"Better Stack","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fbetter-stack","4.integrate\u002Fadapters\u002Fcloud\u002F04.better-stack","i-simple-icons-betterstack",{"title":171,"path":172,"stem":173,"icon":174},"Datadog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fdatadog","4.integrate\u002Fadapters\u002Fcloud\u002F05.datadog","i-simple-icons-datadog",{"title":176,"path":177,"stem":178,"children":179,"page":29},"Cloud or Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fhybrid","4.integrate\u002Fadapters\u002Fhybrid",[180,185,190,195],{"title":181,"path":182,"stem":183,"icon":184},"Grafana Loki","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Floki","4.integrate\u002Fadapters\u002Fhybrid\u002F01.loki","i-simple-icons-grafana",{"title":186,"path":187,"stem":188,"icon":189},"ClickHouse","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fclickhouse","4.integrate\u002Fadapters\u002Fhybrid\u002F02.clickhouse","i-simple-icons-clickhouse",{"title":191,"path":192,"stem":193,"icon":194},"OTLP","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fotlp","4.integrate\u002Fadapters\u002Fhybrid\u002F03.otlp","i-simple-icons-opentelemetry",{"title":196,"path":197,"stem":198,"icon":199},"HyperDX","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fhyperdx","4.integrate\u002Fadapters\u002Fhybrid\u002F04.hyperdx","i-custom-hyperdx",{"title":201,"path":202,"stem":203,"children":204,"page":29},"Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fself-hosted","4.integrate\u002Fadapters\u002Fself-hosted",[205,210,215],{"title":206,"path":207,"stem":208,"icon":209},"File System","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Ffs","4.integrate\u002Fadapters\u002Fself-hosted\u002F01.fs","i-lucide-hard-drive",{"title":211,"path":212,"stem":213,"icon":214},"NuxtHub","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fnuxthub","4.integrate\u002Fadapters\u002Fself-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":216,"path":217,"stem":218,"icon":219},"Memory","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fmemory","4.integrate\u002Fadapters\u002Fself-hosted\u002F03.memory","i-lucide-cpu",{"title":221,"path":222,"stem":223,"children":224,"page":29},"Frameworks","\u002Fintegrate\u002Fframeworks","4.integrate\u002Fframeworks",[225,229,234,239,244,249,254,259,264,269,274,279,284,289,293,298,303],{"title":36,"path":226,"stem":227,"icon":228},"\u002Fintegrate\u002Fframeworks\u002Foverview","4.integrate\u002Fframeworks\u002F00.overview","i-lucide-layout-grid",{"title":230,"path":231,"stem":232,"icon":233},"Nuxt","\u002Fintegrate\u002Fframeworks\u002Fnuxt","4.integrate\u002Fframeworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":235,"path":236,"stem":237,"icon":238},"Next.js","\u002Fintegrate\u002Fframeworks\u002Fnextjs","4.integrate\u002Fframeworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":240,"path":241,"stem":242,"icon":243},"SvelteKit","\u002Fintegrate\u002Fframeworks\u002Fsveltekit","4.integrate\u002Fframeworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":245,"path":246,"stem":247,"icon":248},"Nitro","\u002Fintegrate\u002Fframeworks\u002Fnitro","4.integrate\u002Fframeworks\u002F04.nitro","i-custom-nitro",{"title":250,"path":251,"stem":252,"icon":253},"TanStack Start","\u002Fintegrate\u002Fframeworks\u002Ftanstack-start","4.integrate\u002Fframeworks\u002F05.tanstack-start","i-custom-tanstack",{"title":255,"path":256,"stem":257,"icon":258},"NestJS","\u002Fintegrate\u002Fframeworks\u002Fnestjs","4.integrate\u002Fframeworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":260,"path":261,"stem":262,"icon":263},"Express","\u002Fintegrate\u002Fframeworks\u002Fexpress","4.integrate\u002Fframeworks\u002F07.express","i-simple-icons-express",{"title":265,"path":266,"stem":267,"icon":268},"Hono","\u002Fintegrate\u002Fframeworks\u002Fhono","4.integrate\u002Fframeworks\u002F08.hono","i-simple-icons-hono",{"title":270,"path":271,"stem":272,"icon":273},"Fastify","\u002Fintegrate\u002Fframeworks\u002Ffastify","4.integrate\u002Fframeworks\u002F09.fastify","i-simple-icons-fastify",{"title":275,"path":276,"stem":277,"icon":278},"Elysia","\u002Fintegrate\u002Fframeworks\u002Felysia","4.integrate\u002Fframeworks\u002F10.elysia","i-custom-elysia",{"title":280,"path":281,"stem":282,"icon":283},"React Router","\u002Fintegrate\u002Fframeworks\u002Freact-router","4.integrate\u002Fframeworks\u002F11.react-router","i-custom-reactrouter",{"title":285,"path":286,"stem":287,"icon":288},"Cloudflare Workers","\u002Fintegrate\u002Fframeworks\u002Fcloudflare-workers","4.integrate\u002Fframeworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":290,"path":291,"stem":292,"icon":74},"Standalone","\u002Fintegrate\u002Fframeworks\u002Fstandalone","4.integrate\u002Fframeworks\u002F13.standalone",{"title":294,"path":295,"stem":296,"icon":297},"Astro","\u002Fintegrate\u002Fframeworks\u002Fastro","4.integrate\u002Fframeworks\u002F14.astro","i-simple-icons-astro",{"title":299,"path":300,"stem":301,"icon":302},"oRPC","\u002Fintegrate\u002Fframeworks\u002Forpc","4.integrate\u002Fframeworks\u002F15.orpc","i-lucide-network",{"title":304,"path":305,"stem":306,"icon":307},"AWS Lambda","\u002Fintegrate\u002Fframeworks\u002Faws-lambda","4.integrate\u002Fframeworks\u002F16.aws-lambda","i-custom-lambda",{"title":309,"path":310,"stem":311,"children":312,"page":29},"Use Cases","\u002Fuse-cases","5.use-cases",[313,316,321,350,377,409,430,435],{"title":36,"path":314,"stem":315,"icon":102},"\u002Fuse-cases\u002Foverview","5.use-cases\u002F0.overview",{"title":317,"path":318,"stem":319,"icon":320},"Client Logging","\u002Fuse-cases\u002Fclient-logging","5.use-cases\u002F1.client-logging","i-lucide-monitor",{"title":322,"icon":323,"path":324,"stem":325,"children":326,"page":29},"AI SDK","i-simple-icons-vercel","\u002Fuse-cases\u002Fai-sdk","5.use-cases\u002F2.ai-sdk",[327,330,335,340,345],{"title":36,"path":328,"stem":329,"icon":39},"\u002Fuse-cases\u002Fai-sdk\u002Foverview","5.use-cases\u002F2.ai-sdk\u002F01.overview",{"title":331,"path":332,"stem":333,"icon":334},"Usage","\u002Fuse-cases\u002Fai-sdk\u002Fusage","5.use-cases\u002F2.ai-sdk\u002F02.usage","i-lucide-code",{"title":336,"path":337,"stem":338,"icon":339},"Options","\u002Fuse-cases\u002Fai-sdk\u002Foptions","5.use-cases\u002F2.ai-sdk\u002F03.options","i-lucide-sliders",{"title":341,"path":342,"stem":343,"icon":344},"Metadata","\u002Fuse-cases\u002Fai-sdk\u002Fmetadata","5.use-cases\u002F2.ai-sdk\u002F04.metadata","i-lucide-database",{"title":346,"path":347,"stem":348,"icon":349},"Telemetry","\u002Fuse-cases\u002Fai-sdk\u002Ftelemetry","5.use-cases\u002F2.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":351,"icon":352,"path":353,"stem":354,"children":355,"page":29},"Better Auth","i-simple-icons-betterauth","\u002Fuse-cases\u002Fbetter-auth","5.use-cases\u002F3.better-auth",[356,359,364,369,373],{"title":36,"path":357,"stem":358,"icon":39},"\u002Fuse-cases\u002Fbetter-auth\u002Foverview","5.use-cases\u002F3.better-auth\u002F01.overview",{"title":360,"path":361,"stem":362,"icon":363},"Identify User","\u002Fuse-cases\u002Fbetter-auth\u002Fidentify-user","5.use-cases\u002F3.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":365,"path":366,"stem":367,"icon":368},"Middleware","\u002Fuse-cases\u002Fbetter-auth\u002Fmiddleware","5.use-cases\u002F3.better-auth\u002F03.middleware","i-lucide-shield",{"title":370,"path":371,"stem":372,"icon":320},"Client Sync","\u002Fuse-cases\u002Fbetter-auth\u002Fclient-sync","5.use-cases\u002F3.better-auth\u002F04.client-sync",{"title":374,"path":375,"stem":376,"icon":107},"Performance","\u002Fuse-cases\u002Fbetter-auth\u002Fperformance","5.use-cases\u002F3.better-auth\u002F05.performance",{"title":378,"icon":379,"path":380,"stem":381,"children":382,"page":29},"Audit Logs","i-lucide-shield-check","\u002Fuse-cases\u002Faudit","5.use-cases\u002F4.audit",[383,386,391,396,401,405],{"title":36,"path":384,"stem":385,"icon":39},"\u002Fuse-cases\u002Faudit\u002Foverview","5.use-cases\u002F4.audit\u002F01.overview",{"title":387,"path":388,"stem":389,"icon":390},"Schema","\u002Fuse-cases\u002Faudit\u002Fschema","5.use-cases\u002F4.audit\u002F02.schema","i-lucide-file-text",{"title":392,"path":393,"stem":394,"icon":395},"Recording","\u002Fuse-cases\u002Faudit\u002Frecording","5.use-cases\u002F4.audit\u002F03.recording","i-lucide-pen-line",{"title":397,"path":398,"stem":399,"icon":400},"Drains","\u002Fuse-cases\u002Faudit\u002Fpipeline","5.use-cases\u002F4.audit\u002F04.pipeline","i-lucide-link",{"title":402,"path":403,"stem":404,"icon":379},"Compliance","\u002Fuse-cases\u002Faudit\u002Fcompliance","5.use-cases\u002F4.audit\u002F05.compliance",{"title":406,"path":407,"stem":408,"icon":79},"Recipes","\u002Fuse-cases\u002Faudit\u002Frecipes","5.use-cases\u002F4.audit\u002F06.recipes",{"title":346,"icon":107,"path":410,"stem":411,"children":412,"page":29},"\u002Fuse-cases\u002Ftelemetry","5.use-cases\u002F4.telemetry",[413,416,421,426],{"title":36,"path":414,"stem":415,"icon":39},"\u002Fuse-cases\u002Ftelemetry\u002Foverview","5.use-cases\u002F4.telemetry\u002F01.overview",{"title":417,"path":418,"stem":419,"icon":420},"Setup","\u002Fuse-cases\u002Ftelemetry\u002Fsetup","5.use-cases\u002F4.telemetry\u002F02.setup","i-lucide-wrench",{"title":422,"path":423,"stem":424,"icon":425},"Ingest","\u002Fuse-cases\u002Ftelemetry\u002Fingest","5.use-cases\u002F4.telemetry\u002F03.ingest","i-lucide-server",{"title":427,"path":428,"stem":429,"icon":79},"Reference","\u002Fuse-cases\u002Ftelemetry\u002Freference","5.use-cases\u002F4.telemetry\u002F04.reference",{"title":431,"path":432,"stem":433,"icon":434},"Enrichers","\u002Fuse-cases\u002Fenrichers","5.use-cases\u002F5.enrichers","i-lucide-sparkles",{"title":436,"path":437,"stem":438,"icon":439},"eve","\u002Fuse-cases\u002Feve","5.use-cases\u002F5.eve","i-custom-eve",{"title":441,"path":442,"stem":443,"children":444,"page":29},"Extend","\u002Fextend","6.extend",[445,449,454,459,463,468,472,476,480,484,489,494],{"title":36,"path":446,"stem":447,"icon":448},"\u002Fextend\u002Foverview","6.extend\u002F0.overview","i-lucide-blocks",{"title":450,"path":451,"stem":452,"icon":453},"Stream","\u002Fextend\u002Fstream","6.extend\u002F1.stream","i-lucide-radio-tower",{"title":455,"path":456,"stem":457,"icon":458},"Custom framework","\u002Fextend\u002Fcustom-framework","6.extend\u002F10.custom-framework","i-lucide-puzzle",{"title":460,"path":461,"stem":462,"icon":453},"Diagnostics channel","\u002Fextend\u002Fdiagnostics-channel","6.extend\u002F11.diagnostics-channel",{"title":464,"path":465,"stem":466,"icon":467},"FS reader","\u002Fextend\u002Ffs-reader","6.extend\u002F2.fs-reader","i-lucide-folder-search",{"title":406,"path":469,"stem":470,"icon":471},"\u002Fextend\u002Fconsumer-recipes","6.extend\u002F3.consumer-recipes","i-lucide-chef-hat",{"title":473,"path":474,"stem":475,"icon":448},"Plugins","\u002Fextend\u002Fplugins","6.extend\u002F4.plugins",{"title":477,"path":478,"stem":479,"icon":434},"Custom enrichers","\u002Fextend\u002Fcustom-enrichers","6.extend\u002F5.custom-enrichers",{"title":481,"path":482,"stem":483,"icon":64},"Tail sampling","\u002Fextend\u002Ftail-sampling","6.extend\u002F6.tail-sampling",{"title":485,"path":486,"stem":487,"icon":488},"Identity headers","\u002Fextend\u002Fidentity-headers","6.extend\u002F7.identity-headers","i-lucide-fingerprint",{"title":490,"path":491,"stem":492,"icon":493},"Custom drains","\u002Fextend\u002Fcustom-drains","6.extend\u002F8.custom-drains","i-lucide-share-2",{"title":495,"path":496,"stem":497,"icon":498},"Drain pipeline","\u002Fextend\u002Fdrain-pipeline","6.extend\u002F9.drain-pipeline","i-lucide-workflow",{"title":427,"path":500,"stem":501,"children":502,"page":29},"\u002Freference","7.reference",[503,508,511,516,520,525],{"title":504,"path":505,"stem":506,"icon":507},"Configuration","\u002Freference\u002Fconfiguration","7.reference\u002F1.configuration","i-lucide-settings",{"title":374,"path":509,"stem":510,"icon":107},"\u002Freference\u002Fperformance","7.reference\u002F2.performance",{"title":512,"path":513,"stem":514,"icon":515},"Vite Plugin","\u002Freference\u002Fvite-plugin","7.reference\u002F3.vite-plugin","i-custom-vite",{"title":517,"path":518,"stem":519,"icon":379},"Best Practices","\u002Freference\u002Fbest-practices","7.reference\u002F4.best-practices",{"title":521,"path":522,"stem":523,"icon":524},"vs Other Loggers","\u002Freference\u002Fvs-other-loggers","7.reference\u002F5.vs-other-loggers","i-lucide-scale",{"title":526,"path":527,"stem":528,"icon":434},"Agent Skills","\u002Freference\u002Fagent-skills","7.reference\u002F6.agent-skills",{"id":530,"title":531,"body":532,"description":3451,"extension":3452,"links":3453,"meta":3461,"navigation":3462,"path":157,"seo":3463,"stem":158,"__hash__":3464},"docs\u002F4.integrate\u002Fadapters\u002Fcloud\u002F02.posthog.md","PostHog Adapter",{"type":533,"value":534,"toc":3416},"minimark",[535,551,596,600,603,647,650,655,686,690,709,713,1291,1294,1297,1300,1330,1334,1375,1379,1386,1467,1471,1474,1531,1535,1708,1712,1722,1766,1770,1785,1798,1832,1835,1845,1849,1856,1865,1948,1955,2059,2063,2066,2123,2130,2166,2172,2187,2191,2197,2237,2265,2269,2275,2288,2292,2301,2396,2407,2413,2429,2433,2552,2556,2559,2647,2651,2657,2687,2691,2698,2709,2800,2803,2807,2882,2885,3024,3028,3032,3041,3044,3048,3051,3071,3075,3081,3094,3098,3101,3220,3223,3383,3387,3412],[536,537,538,544,545,550],"p",{},[539,540,156],"a",{"href":541,"rel":542},"https:\u002F\u002Fposthog.com",[543],"nofollow"," is an open-source product analytics platform. The evlog PostHog adapter sends your wide events to ",[539,546,549],{"href":547,"rel":548},"https:\u002F\u002Fposthog.com\u002Fdocs\u002Flogs",[543],"PostHog Logs"," via the standard OTLP format, giving you a dedicated log viewer with filtering, search, and tail mode using your existing PostHog API key.",[552,553,556,559,584],"prompt",{":actions":554,"description":555,"icon":159},"[\"copy\",\"cursor\",\"claude\"]","Add the PostHog drain adapter",[536,557,558],{},"Add the PostHog drain adapter to send evlog wide events to PostHog Logs.",[560,561,562,566,569,572,575,578,581],"ol",{},[563,564,565],"li",{},"Identify which framework I'm using and follow its evlog integration pattern",[563,567,568],{},"Install evlog if not already installed",[563,570,571],{},"Import createPostHogDrain from 'evlog\u002Fposthog'",[563,573,574],{},"Wire createPostHogDrain() into my framework's drain configuration",[563,576,577],{},"Set POSTHOG_API_KEY environment variable",[563,579,580],{},"Optionally set POSTHOG_HOST for EU or self-hosted instances",[563,582,583],{},"Test by triggering a request and checking PostHog > Logs",[536,585,586,587,591,592],{},"Adapter docs: ",[539,588,589],{"href":589,"rel":590},"https:\u002F\u002Fwww.evlog.dev\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fposthog",[543],"\nFramework setup: ",[539,593,594],{"href":594,"rel":595},"https:\u002F\u002Fwww.evlog.dev\u002Fintegrate\u002Fframeworks\u002Foverview",[543],[597,598,20],"h2",{"id":599},"installation",[536,601,602],{},"The PostHog adapter comes bundled with evlog:",[604,605,611],"pre",{"className":606,"code":607,"filename":608,"language":609,"meta":610,"style":610},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createPostHogDrain } from 'evlog\u002Fposthog'\n","src\u002Findex.ts","typescript","",[612,613,614],"code",{"__ignoreMap":610},[615,616,619,623,627,631,634,637,640,644],"span",{"class":617,"line":618},"line",1,[615,620,622],{"class":621},"s7zQu","import",[615,624,626],{"class":625},"sMK4o"," {",[615,628,630],{"class":629},"sTEyZ"," createPostHogDrain",[615,632,633],{"class":625}," }",[615,635,636],{"class":621}," from",[615,638,639],{"class":625}," '",[615,641,643],{"class":642},"sfazB","evlog\u002Fposthog",[615,645,646],{"class":625},"'\n",[597,648,25],{"id":649},"quick-start",[651,652,654],"h3",{"id":653},"_1-get-your-posthog-project-api-key","1. Get your PostHog project API key",[560,656,657,665,679],{},[563,658,659,660],{},"Log in to your ",[539,661,664],{"href":662,"rel":663},"https:\u002F\u002Fapp.posthog.com",[543],"PostHog dashboard",[563,666,667,668,672,673,672,676],{},"Go to ",[669,670,671],"strong",{},"Settings"," > ",[669,674,675],{},"Project",[669,677,678],{},"Project API Key",[563,680,681,682,685],{},"Copy the key (starts with ",[612,683,684],{},"phc_",")",[651,687,689],{"id":688},"_2-set-environment-variables","2. Set environment variables",[604,691,696],{"className":692,"code":693,"filename":694,"language":695,"meta":610,"style":610},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","POSTHOG_API_KEY=phc_your-project-api-key\n",".env","bash",[612,697,698],{"__ignoreMap":610},[615,699,700,703,706],{"class":617,"line":618},[615,701,702],{"class":629},"POSTHOG_API_KEY",[615,704,705],{"class":625},"=",[615,707,708],{"class":642},"phc_your-project-api-key\n",[651,710,712],{"id":711},"_3-wire-the-drain-to-your-framework","3. Wire the drain to your framework",[714,715,716,830,961,1023,1077,1136,1190,1243],"code-group",{},[604,717,720],{"className":606,"code":718,"filename":719,"language":609,"meta":610,"style":610},"\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\nimport { createPostHogDrain } from 'evlog\u002Fposthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain())\n})\n","Nuxt \u002F Nitro",[612,721,722,728,747,754,785,821],{"__ignoreMap":610},[615,723,724],{"class":617,"line":618},[615,725,727],{"class":726},"sHwdD","\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\n",[615,729,731,733,735,737,739,741,743,745],{"class":617,"line":730},2,[615,732,622],{"class":621},[615,734,626],{"class":625},[615,736,630],{"class":629},[615,738,633],{"class":625},[615,740,636],{"class":621},[615,742,639],{"class":625},[615,744,643],{"class":642},[615,746,646],{"class":625},[615,748,750],{"class":617,"line":749},3,[615,751,753],{"emptyLinePlaceholder":752},true,"\n",[615,755,757,760,763,767,770,772,776,778,782],{"class":617,"line":756},4,[615,758,759],{"class":621},"export",[615,761,762],{"class":621}," default",[615,764,766],{"class":765},"s2Zo4"," defineNitroPlugin",[615,768,769],{"class":629},"(",[615,771,769],{"class":625},[615,773,775],{"class":774},"sHdIc","nitroApp",[615,777,685],{"class":625},[615,779,781],{"class":780},"spNyl"," =>",[615,783,784],{"class":625}," {\n",[615,786,788,791,794,797,799,802,805,808,811,813,816,818],{"class":617,"line":787},5,[615,789,790],{"class":629},"  nitroApp",[615,792,793],{"class":625},".",[615,795,796],{"class":629},"hooks",[615,798,793],{"class":625},[615,800,801],{"class":765},"hook",[615,803,769],{"class":804},"swJcz",[615,806,807],{"class":625},"'",[615,809,810],{"class":642},"evlog:drain",[615,812,807],{"class":625},[615,814,815],{"class":625},",",[615,817,630],{"class":765},[615,819,820],{"class":804},"())\n",[615,822,824,827],{"class":617,"line":823},6,[615,825,826],{"class":625},"}",[615,828,829],{"class":629},")\n",[604,831,833],{"className":606,"code":832,"filename":235,"language":609,"meta":610,"style":610},"\u002F\u002F lib\u002Fevlog.ts\nimport { createEvlog } from 'evlog\u002Fnext'\nimport { createPostHogDrain } from 'evlog\u002Fposthog'\n\nexport const { withEvlog, useLogger, log, createError } = createEvlog({\n  service: 'my-app',\n  drain: createPostHogDrain(),\n})\n",[612,834,835,840,860,878,882,921,939,954],{"__ignoreMap":610},[615,836,837],{"class":617,"line":618},[615,838,839],{"class":726},"\u002F\u002F lib\u002Fevlog.ts\n",[615,841,842,844,846,849,851,853,855,858],{"class":617,"line":730},[615,843,622],{"class":621},[615,845,626],{"class":625},[615,847,848],{"class":629}," createEvlog",[615,850,633],{"class":625},[615,852,636],{"class":621},[615,854,639],{"class":625},[615,856,857],{"class":642},"evlog\u002Fnext",[615,859,646],{"class":625},[615,861,862,864,866,868,870,872,874,876],{"class":617,"line":749},[615,863,622],{"class":621},[615,865,626],{"class":625},[615,867,630],{"class":629},[615,869,633],{"class":625},[615,871,636],{"class":621},[615,873,639],{"class":625},[615,875,643],{"class":642},[615,877,646],{"class":625},[615,879,880],{"class":617,"line":756},[615,881,753],{"emptyLinePlaceholder":752},[615,883,884,886,889,891,894,896,899,901,904,906,909,911,914,916,918],{"class":617,"line":787},[615,885,759],{"class":621},[615,887,888],{"class":780}," const",[615,890,626],{"class":625},[615,892,893],{"class":629}," withEvlog",[615,895,815],{"class":625},[615,897,898],{"class":629}," useLogger",[615,900,815],{"class":625},[615,902,903],{"class":629}," log",[615,905,815],{"class":625},[615,907,908],{"class":629}," createError ",[615,910,826],{"class":625},[615,912,913],{"class":625}," =",[615,915,848],{"class":765},[615,917,769],{"class":629},[615,919,920],{"class":625},"{\n",[615,922,923,926,929,931,934,936],{"class":617,"line":823},[615,924,925],{"class":804},"  service",[615,927,928],{"class":625},":",[615,930,639],{"class":625},[615,932,933],{"class":642},"my-app",[615,935,807],{"class":625},[615,937,938],{"class":625},",\n",[615,940,942,945,947,949,952],{"class":617,"line":941},7,[615,943,944],{"class":804},"  drain",[615,946,928],{"class":625},[615,948,630],{"class":765},[615,950,951],{"class":629},"()",[615,953,938],{"class":625},[615,955,957,959],{"class":617,"line":956},8,[615,958,826],{"class":625},[615,960,829],{"class":629},[604,962,964],{"className":606,"code":963,"filename":265,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\napp.use(evlog({ drain: createPostHogDrain() }))\n",[612,965,966,984,988],{"__ignoreMap":610},[615,967,968,970,972,974,976,978,980,982],{"class":617,"line":618},[615,969,622],{"class":621},[615,971,626],{"class":625},[615,973,630],{"class":629},[615,975,633],{"class":625},[615,977,636],{"class":621},[615,979,639],{"class":625},[615,981,643],{"class":642},[615,983,646],{"class":625},[615,985,986],{"class":617,"line":730},[615,987,753],{"emptyLinePlaceholder":752},[615,989,990,993,995,998,1000,1003,1005,1008,1011,1013,1015,1018,1020],{"class":617,"line":749},[615,991,992],{"class":629},"app",[615,994,793],{"class":625},[615,996,997],{"class":765},"use",[615,999,769],{"class":629},[615,1001,1002],{"class":765},"evlog",[615,1004,769],{"class":629},[615,1006,1007],{"class":625},"{",[615,1009,1010],{"class":804}," drain",[615,1012,928],{"class":625},[615,1014,630],{"class":765},[615,1016,1017],{"class":629},"() ",[615,1019,826],{"class":625},[615,1021,1022],{"class":629},"))\n",[604,1024,1025],{"className":606,"code":963,"filename":260,"language":609,"meta":610,"style":610},[612,1026,1027,1045,1049],{"__ignoreMap":610},[615,1028,1029,1031,1033,1035,1037,1039,1041,1043],{"class":617,"line":618},[615,1030,622],{"class":621},[615,1032,626],{"class":625},[615,1034,630],{"class":629},[615,1036,633],{"class":625},[615,1038,636],{"class":621},[615,1040,639],{"class":625},[615,1042,643],{"class":642},[615,1044,646],{"class":625},[615,1046,1047],{"class":617,"line":730},[615,1048,753],{"emptyLinePlaceholder":752},[615,1050,1051,1053,1055,1057,1059,1061,1063,1065,1067,1069,1071,1073,1075],{"class":617,"line":749},[615,1052,992],{"class":629},[615,1054,793],{"class":625},[615,1056,997],{"class":765},[615,1058,769],{"class":629},[615,1060,1002],{"class":765},[615,1062,769],{"class":629},[615,1064,1007],{"class":625},[615,1066,1010],{"class":804},[615,1068,928],{"class":625},[615,1070,630],{"class":765},[615,1072,1017],{"class":629},[615,1074,826],{"class":625},[615,1076,1022],{"class":629},[604,1078,1080],{"className":606,"code":1079,"filename":270,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\nawait app.register(evlog, { drain: createPostHogDrain() })\n",[612,1081,1082,1100,1104],{"__ignoreMap":610},[615,1083,1084,1086,1088,1090,1092,1094,1096,1098],{"class":617,"line":618},[615,1085,622],{"class":621},[615,1087,626],{"class":625},[615,1089,630],{"class":629},[615,1091,633],{"class":625},[615,1093,636],{"class":621},[615,1095,639],{"class":625},[615,1097,643],{"class":642},[615,1099,646],{"class":625},[615,1101,1102],{"class":617,"line":730},[615,1103,753],{"emptyLinePlaceholder":752},[615,1105,1106,1109,1112,1114,1117,1120,1122,1124,1126,1128,1130,1132,1134],{"class":617,"line":749},[615,1107,1108],{"class":621},"await",[615,1110,1111],{"class":629}," app",[615,1113,793],{"class":625},[615,1115,1116],{"class":765},"register",[615,1118,1119],{"class":629},"(evlog",[615,1121,815],{"class":625},[615,1123,626],{"class":625},[615,1125,1010],{"class":804},[615,1127,928],{"class":625},[615,1129,630],{"class":765},[615,1131,1017],{"class":629},[615,1133,826],{"class":625},[615,1135,829],{"class":629},[604,1137,1138],{"className":606,"code":963,"filename":275,"language":609,"meta":610,"style":610},[612,1139,1140,1158,1162],{"__ignoreMap":610},[615,1141,1142,1144,1146,1148,1150,1152,1154,1156],{"class":617,"line":618},[615,1143,622],{"class":621},[615,1145,626],{"class":625},[615,1147,630],{"class":629},[615,1149,633],{"class":625},[615,1151,636],{"class":621},[615,1153,639],{"class":625},[615,1155,643],{"class":642},[615,1157,646],{"class":625},[615,1159,1160],{"class":617,"line":730},[615,1161,753],{"emptyLinePlaceholder":752},[615,1163,1164,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188],{"class":617,"line":749},[615,1165,992],{"class":629},[615,1167,793],{"class":625},[615,1169,997],{"class":765},[615,1171,769],{"class":629},[615,1173,1002],{"class":765},[615,1175,769],{"class":629},[615,1177,1007],{"class":625},[615,1179,1010],{"class":804},[615,1181,928],{"class":625},[615,1183,630],{"class":765},[615,1185,1017],{"class":629},[615,1187,826],{"class":625},[615,1189,1022],{"class":629},[604,1191,1193],{"className":606,"code":1192,"filename":255,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\nEvlogModule.forRoot({ drain: createPostHogDrain() })\n",[612,1194,1195,1213,1217],{"__ignoreMap":610},[615,1196,1197,1199,1201,1203,1205,1207,1209,1211],{"class":617,"line":618},[615,1198,622],{"class":621},[615,1200,626],{"class":625},[615,1202,630],{"class":629},[615,1204,633],{"class":625},[615,1206,636],{"class":621},[615,1208,639],{"class":625},[615,1210,643],{"class":642},[615,1212,646],{"class":625},[615,1214,1215],{"class":617,"line":730},[615,1216,753],{"emptyLinePlaceholder":752},[615,1218,1219,1222,1224,1227,1229,1231,1233,1235,1237,1239,1241],{"class":617,"line":749},[615,1220,1221],{"class":629},"EvlogModule",[615,1223,793],{"class":625},[615,1225,1226],{"class":765},"forRoot",[615,1228,769],{"class":629},[615,1230,1007],{"class":625},[615,1232,1010],{"class":804},[615,1234,928],{"class":625},[615,1236,630],{"class":765},[615,1238,1017],{"class":629},[615,1240,826],{"class":625},[615,1242,829],{"class":629},[604,1244,1246],{"className":606,"code":1245,"filename":290,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\ninitLogger({ drain: createPostHogDrain() })\n",[612,1247,1248,1266,1270],{"__ignoreMap":610},[615,1249,1250,1252,1254,1256,1258,1260,1262,1264],{"class":617,"line":618},[615,1251,622],{"class":621},[615,1253,626],{"class":625},[615,1255,630],{"class":629},[615,1257,633],{"class":625},[615,1259,636],{"class":621},[615,1261,639],{"class":625},[615,1263,643],{"class":642},[615,1265,646],{"class":625},[615,1267,1268],{"class":617,"line":730},[615,1269,753],{"emptyLinePlaceholder":752},[615,1271,1272,1275,1277,1279,1281,1283,1285,1287,1289],{"class":617,"line":749},[615,1273,1274],{"class":765},"initLogger",[615,1276,769],{"class":629},[615,1278,1007],{"class":625},[615,1280,1010],{"class":804},[615,1282,928],{"class":625},[615,1284,630],{"class":765},[615,1286,1017],{"class":629},[615,1288,826],{"class":625},[615,1290,829],{"class":629},[536,1292,1293],{},"That's it! Your wide events will now appear in PostHog Logs with full OTLP structure including severity levels, trace context, and structured attributes.",[597,1295,504],{"id":1296},"configuration",[536,1298,1299],{},"The adapter reads configuration from multiple sources (highest priority first):",[560,1301,1302,1311,1321],{},[563,1303,1304,1307,1308],{},[669,1305,1306],{},"Overrides"," passed to ",[612,1309,1310],{},"createPostHogDrain()",[563,1312,1313,1316,1317,1320],{},[669,1314,1315],{},"Runtime config"," at ",[612,1318,1319],{},"runtimeConfig.posthog"," (Nuxt\u002FNitro only)",[563,1322,1323,1326,1327,685],{},[669,1324,1325],{},"Environment variables"," (",[612,1328,1329],{},"POSTHOG_*",[651,1331,1333],{"id":1332},"environment-variables","Environment Variables",[1335,1336,1337,1350],"table",{},[1338,1339,1340],"thead",{},[1341,1342,1343,1347],"tr",{},[1344,1345,1346],"th",{},"Variable",[1344,1348,1349],{},"Description",[1351,1352,1353,1365],"tbody",{},[1341,1354,1355,1360],{},[1356,1357,1358],"td",{},[612,1359,702],{},[1356,1361,1362,1363,685],{},"Project API key (starts with ",[612,1364,684],{},[1341,1366,1367,1372],{},[1356,1368,1369],{},[612,1370,1371],{},"POSTHOG_HOST",[1356,1373,1374],{},"PostHog host URL (for EU or self-hosted)",[651,1376,1378],{"id":1377},"runtime-config-nuxt-only","Runtime Config (Nuxt only)",[536,1380,1381,1382,1385],{},"Configure via ",[612,1383,1384],{},"nuxt.config.ts"," for type-safe configuration:",[604,1387,1389],{"className":606,"code":1388,"filename":1384,"language":609,"meta":610,"style":610},"export default defineNuxtConfig({\n  runtimeConfig: {\n    posthog: {\n      apiKey: '', \u002F\u002F Set via POSTHOG_API_KEY\n      host: '', \u002F\u002F Set via POSTHOG_HOST\n    },\n  },\n})\n",[612,1390,1391,1404,1413,1422,1437,1451,1456,1461],{"__ignoreMap":610},[615,1392,1393,1395,1397,1400,1402],{"class":617,"line":618},[615,1394,759],{"class":621},[615,1396,762],{"class":621},[615,1398,1399],{"class":765}," defineNuxtConfig",[615,1401,769],{"class":629},[615,1403,920],{"class":625},[615,1405,1406,1409,1411],{"class":617,"line":730},[615,1407,1408],{"class":804},"  runtimeConfig",[615,1410,928],{"class":625},[615,1412,784],{"class":625},[615,1414,1415,1418,1420],{"class":617,"line":749},[615,1416,1417],{"class":804},"    posthog",[615,1419,928],{"class":625},[615,1421,784],{"class":625},[615,1423,1424,1427,1429,1432,1434],{"class":617,"line":756},[615,1425,1426],{"class":804},"      apiKey",[615,1428,928],{"class":625},[615,1430,1431],{"class":625}," ''",[615,1433,815],{"class":625},[615,1435,1436],{"class":726}," \u002F\u002F Set via POSTHOG_API_KEY\n",[615,1438,1439,1442,1444,1446,1448],{"class":617,"line":787},[615,1440,1441],{"class":804},"      host",[615,1443,928],{"class":625},[615,1445,1431],{"class":625},[615,1447,815],{"class":625},[615,1449,1450],{"class":726}," \u002F\u002F Set via POSTHOG_HOST\n",[615,1452,1453],{"class":617,"line":823},[615,1454,1455],{"class":625},"    },\n",[615,1457,1458],{"class":617,"line":941},[615,1459,1460],{"class":625},"  },\n",[615,1462,1463,1465],{"class":617,"line":956},[615,1464,826],{"class":625},[615,1466,829],{"class":629},[651,1468,1470],{"id":1469},"override-options","Override Options",[536,1472,1473],{},"Pass options directly to override any configuration:",[604,1475,1478],{"className":606,"code":1476,"filename":1477,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({\n  host: 'https:\u002F\u002Feu.i.posthog.com',\n  timeout: 10000,\n})\n","server\u002Fplugins\u002Fevlog-drain.ts",[612,1479,1480,1496,1512,1525],{"__ignoreMap":610},[615,1481,1482,1485,1488,1490,1492,1494],{"class":617,"line":618},[615,1483,1484],{"class":780},"const",[615,1486,1487],{"class":629}," drain ",[615,1489,705],{"class":625},[615,1491,630],{"class":765},[615,1493,769],{"class":629},[615,1495,920],{"class":625},[615,1497,1498,1501,1503,1505,1508,1510],{"class":617,"line":730},[615,1499,1500],{"class":804},"  host",[615,1502,928],{"class":625},[615,1504,639],{"class":625},[615,1506,1507],{"class":642},"https:\u002F\u002Feu.i.posthog.com",[615,1509,807],{"class":625},[615,1511,938],{"class":625},[615,1513,1514,1517,1519,1523],{"class":617,"line":749},[615,1515,1516],{"class":804},"  timeout",[615,1518,928],{"class":625},[615,1520,1522],{"class":1521},"sbssI"," 10000",[615,1524,938],{"class":625},[615,1526,1527,1529],{"class":617,"line":756},[615,1528,826],{"class":625},[615,1530,829],{"class":629},[651,1532,1534],{"id":1533},"full-configuration-reference","Full Configuration Reference",[1335,1536,1537,1552],{},[1338,1538,1539],{},[1341,1540,1541,1544,1547,1550],{},[1344,1542,1543],{},"Option",[1344,1545,1546],{},"Type",[1344,1548,1549],{},"Default",[1344,1551,1349],{},[1351,1553,1554,1572,1591,1607,1626,1645,1669,1689],{},[1341,1555,1556,1561,1566,1569],{},[1356,1557,1558],{},[612,1559,1560],{},"apiKey",[1356,1562,1563],{},[612,1564,1565],{},"string",[1356,1567,1568],{},"-",[1356,1570,1571],{},"Project API key (required)",[1341,1573,1574,1579,1583,1588],{},[1356,1575,1576],{},[612,1577,1578],{},"host",[1356,1580,1581],{},[612,1582,1565],{},[1356,1584,1585],{},[612,1586,1587],{},"https:\u002F\u002Fus.i.posthog.com",[1356,1589,1590],{},"PostHog host URL",[1341,1592,1593,1598,1602,1604],{},[1356,1594,1595],{},[612,1596,1597],{},"distinctId",[1356,1599,1600],{},[612,1601,1565],{},[1356,1603,1568],{},[1356,1605,1606],{},"Static person identifier for every event",[1341,1608,1609,1614,1618,1623],{},[1356,1610,1611],{},[612,1612,1613],{},"distinctIdField",[1356,1615,1616],{},[612,1617,1565],{},[1356,1619,1620],{},[612,1621,1622],{},"userId",[1356,1624,1625],{},"Event field holding the person identifier (dot path)",[1341,1627,1628,1633,1637,1642],{},[1356,1629,1630],{},[612,1631,1632],{},"sessionIdField",[1356,1634,1635],{},[612,1636,1565],{},[1356,1638,1639],{},[612,1640,1641],{},"sessionId",[1356,1643,1644],{},"Event field holding the PostHog session id (dot path)",[1341,1646,1647,1652,1657,1662],{},[1356,1648,1649],{},[612,1650,1651],{},"recordShape",[1356,1653,1654],{},[612,1655,1656],{},"'json' | 'compact'",[1356,1658,1659],{},[612,1660,1661],{},"'json'",[1356,1663,1664,1665],{},"Log record shape — see ",[539,1666,1668],{"href":1667},"#choosing-a-record-shape","below",[1341,1670,1671,1676,1681,1686],{},[1356,1672,1673],{},[612,1674,1675],{},"timeout",[1356,1677,1678],{},[612,1679,1680],{},"number",[1356,1682,1683],{},[612,1684,1685],{},"5000",[1356,1687,1688],{},"Request timeout in milliseconds",[1341,1690,1691,1696,1700,1705],{},[1356,1692,1693],{},[612,1694,1695],{},"retries",[1356,1697,1698],{},[612,1699,1680],{},[1356,1701,1702],{},[612,1703,1704],{},"2",[1356,1706,1707],{},"Retry attempts on transient failures",[597,1709,1711],{"id":1710},"how-it-works","How It Works",[536,1713,1714,1715,1717,1718,1721],{},"Under the hood, ",[612,1716,1310],{}," wraps the OTLP adapter's ",[612,1719,1720],{},"sendBatchToOTLP()"," with PostHog-specific defaults:",[1723,1724,1725,1735,1744,1754],"ul",{},[563,1726,1727,1730,1731,1734],{},[669,1728,1729],{},"Endpoint",": ",[612,1732,1733],{},"{host}\u002Fi\u002Fv1\u002Flogs"," (PostHog's OTLP log ingest endpoint)",[563,1736,1737,1730,1740,1743],{},[669,1738,1739],{},"Auth",[612,1741,1742],{},"Authorization: Bearer {apiKey}"," header",[563,1745,1746,1749,1750,1753],{},[669,1747,1748],{},"Format",": Standard OTLP ",[612,1751,1752],{},"ExportLogsServiceRequest"," with severity levels, trace context, and structured attributes",[563,1755,1756,1730,1759,1762,1763,1765],{},[669,1757,1758],{},"Identity",[612,1760,1761],{},"posthogDistinctId"," and ",[612,1764,1641],{}," attributes, which is how PostHog joins a log to the rest of your project data",[597,1767,1769],{"id":1768},"choosing-a-record-shape","Choosing a Record Shape",[536,1771,1772,1773,1776,1777,1780,1781,1784],{},"PostHog treats log attributes as facets: you filter, break down, and alert on them. With the default ",[612,1774,1775],{},"json"," shape a nested field arrives as one serialized attribute — ",[612,1778,1779],{},"ai"," = ",[612,1782,1783],{},"{\"calls\":2,\"costUsd\":0.0012}"," — which PostHog can display but not chart.",[536,1786,1787,1790,1791,1762,1794,1797],{},[612,1788,1789],{},"compact"," flattens those into ",[612,1792,1793],{},"ai.calls",[612,1795,1796],{},"ai.costUsd",", and replaces the body with a one-line summary instead of repeating the whole event:",[604,1799,1801],{"className":606,"code":1800,"filename":1477,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({ recordShape: 'compact' })\n",[612,1802,1803],{"__ignoreMap":610},[615,1804,1805,1807,1809,1811,1813,1815,1817,1820,1822,1824,1826,1828,1830],{"class":617,"line":618},[615,1806,1484],{"class":780},[615,1808,1487],{"class":629},[615,1810,705],{"class":625},[615,1812,630],{"class":765},[615,1814,769],{"class":629},[615,1816,1007],{"class":625},[615,1818,1819],{"class":804}," recordShape",[615,1821,928],{"class":625},[615,1823,639],{"class":625},[615,1825,1789],{"class":642},[615,1827,807],{"class":625},[615,1829,633],{"class":625},[615,1831,829],{"class":629},[536,1833,1834],{},"This is the recommended shape for PostHog. It also cuts what you send: Logs is billed per GB ingested, and the default shape transmits every field twice — once in the body, once in the attributes.",[1836,1837,1839,1841,1842,1844],"callout",{"color":1838,"icon":13},"info",[612,1840,1789],{}," becomes the default in the next major. Set it on a new project now; switching later means rewriting the saved views and alerts built on the ",[612,1843,1775],{}," shape.",[597,1846,1848],{"id":1847},"linking-logs-to-people-and-session-replays","Linking Logs to People and Session Replays",[536,1850,1851,1852,1855],{},"A log that carries a person identifier shows up on that person's profile in PostHog, under the ",[669,1853,1854],{},"Logs"," tab — no service-name guessing to find what a specific user hit. Carry a session id too and the log links to their session replay.",[536,1857,1858,1859,1861,1862,1864],{},"PostHog reads both from log attributes: ",[612,1860,1761],{}," for the person, ",[612,1863,1641],{}," for the replay. The adapter fills them from your wide event, so this works as soon as your event carries the values:",[604,1866,1869],{"className":606,"code":1867,"filename":1868,"language":609,"meta":610,"style":610},"const log = useLogger(event)\n\nlog.set({\n  userId: user.id, \u002F\u002F → posthogDistinctId, links to the person\n  sessionId: body.sessionId, \u002F\u002F → sessionId, links to the session replay\n})\n","server\u002Fapi\u002Fcheckout.post.ts",[612,1870,1871,1885,1889,1903,1923,1942],{"__ignoreMap":610},[615,1872,1873,1875,1878,1880,1882],{"class":617,"line":618},[615,1874,1484],{"class":780},[615,1876,1877],{"class":629}," log ",[615,1879,705],{"class":625},[615,1881,898],{"class":765},[615,1883,1884],{"class":629},"(event)\n",[615,1886,1887],{"class":617,"line":730},[615,1888,753],{"emptyLinePlaceholder":752},[615,1890,1891,1894,1896,1899,1901],{"class":617,"line":749},[615,1892,1893],{"class":629},"log",[615,1895,793],{"class":625},[615,1897,1898],{"class":765},"set",[615,1900,769],{"class":629},[615,1902,920],{"class":625},[615,1904,1905,1908,1910,1913,1915,1918,1920],{"class":617,"line":756},[615,1906,1907],{"class":804},"  userId",[615,1909,928],{"class":625},[615,1911,1912],{"class":629}," user",[615,1914,793],{"class":625},[615,1916,1917],{"class":629},"id",[615,1919,815],{"class":625},[615,1921,1922],{"class":726}," \u002F\u002F → posthogDistinctId, links to the person\n",[615,1924,1925,1928,1930,1933,1935,1937,1939],{"class":617,"line":787},[615,1926,1927],{"class":804},"  sessionId",[615,1929,928],{"class":625},[615,1931,1932],{"class":629}," body",[615,1934,793],{"class":625},[615,1936,1641],{"class":629},[615,1938,815],{"class":625},[615,1940,1941],{"class":726}," \u002F\u002F → sessionId, links to the session replay\n",[615,1943,1944,1946],{"class":617,"line":823},[615,1945,826],{"class":625},[615,1947,829],{"class":629},[536,1949,1950,1951,1954],{},"The session id comes from the frontend — read it with ",[612,1952,1953],{},"posthog.get_session_id()"," and send it along with the request:",[604,1956,1959],{"className":606,"code":1957,"filename":1958,"language":609,"meta":610,"style":610},"import posthog from 'posthog-js'\n\nawait $fetch('\u002Fapi\u002Fcheckout', {\n  method: 'POST',\n  body: { ...payload, sessionId: posthog.get_session_id() },\n})\n","app\u002Fcheckout.ts",[612,1960,1961,1978,1982,2002,2018,2053],{"__ignoreMap":610},[615,1962,1963,1965,1968,1971,1973,1976],{"class":617,"line":618},[615,1964,622],{"class":621},[615,1966,1967],{"class":629}," posthog ",[615,1969,1970],{"class":621},"from",[615,1972,639],{"class":625},[615,1974,1975],{"class":642},"posthog-js",[615,1977,646],{"class":625},[615,1979,1980],{"class":617,"line":730},[615,1981,753],{"emptyLinePlaceholder":752},[615,1983,1984,1986,1989,1991,1993,1996,1998,2000],{"class":617,"line":749},[615,1985,1108],{"class":621},[615,1987,1988],{"class":765}," $fetch",[615,1990,769],{"class":629},[615,1992,807],{"class":625},[615,1994,1995],{"class":642},"\u002Fapi\u002Fcheckout",[615,1997,807],{"class":625},[615,1999,815],{"class":625},[615,2001,784],{"class":625},[615,2003,2004,2007,2009,2011,2014,2016],{"class":617,"line":756},[615,2005,2006],{"class":804},"  method",[615,2008,928],{"class":625},[615,2010,639],{"class":625},[615,2012,2013],{"class":642},"POST",[615,2015,807],{"class":625},[615,2017,938],{"class":625},[615,2019,2020,2023,2025,2027,2030,2033,2035,2038,2040,2043,2045,2048,2050],{"class":617,"line":787},[615,2021,2022],{"class":804},"  body",[615,2024,928],{"class":625},[615,2026,626],{"class":625},[615,2028,2029],{"class":625}," ...",[615,2031,2032],{"class":629},"payload",[615,2034,815],{"class":625},[615,2036,2037],{"class":804}," sessionId",[615,2039,928],{"class":625},[615,2041,2042],{"class":629}," posthog",[615,2044,793],{"class":625},[615,2046,2047],{"class":765},"get_session_id",[615,2049,1017],{"class":629},[615,2051,2052],{"class":625},"},\n",[615,2054,2055,2057],{"class":617,"line":823},[615,2056,826],{"class":625},[615,2058,829],{"class":629},[651,2060,2062],{"id":2061},"pointing-at-your-own-fields","Pointing at Your Own Fields",[536,2064,2065],{},"When identity lives somewhere else on your events, point the adapter at it. Both options take a dot path:",[604,2067,2069],{"className":606,"code":2068,"filename":1477,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({\n  distinctIdField: 'user.id',\n  sessionIdField: 'session.id',\n})\n",[612,2070,2071,2085,2101,2117],{"__ignoreMap":610},[615,2072,2073,2075,2077,2079,2081,2083],{"class":617,"line":618},[615,2074,1484],{"class":780},[615,2076,1487],{"class":629},[615,2078,705],{"class":625},[615,2080,630],{"class":765},[615,2082,769],{"class":629},[615,2084,920],{"class":625},[615,2086,2087,2090,2092,2094,2097,2099],{"class":617,"line":730},[615,2088,2089],{"class":804},"  distinctIdField",[615,2091,928],{"class":625},[615,2093,639],{"class":625},[615,2095,2096],{"class":642},"user.id",[615,2098,807],{"class":625},[615,2100,938],{"class":625},[615,2102,2103,2106,2108,2110,2113,2115],{"class":617,"line":749},[615,2104,2105],{"class":804},"  sessionIdField",[615,2107,928],{"class":625},[615,2109,639],{"class":625},[615,2111,2112],{"class":642},"session.id",[615,2114,807],{"class":625},[615,2116,938],{"class":625},[615,2118,2119,2121],{"class":617,"line":756},[615,2120,826],{"class":625},[615,2122,829],{"class":629},[536,2124,2125,2126,2129],{},"For an ",[539,2127,2128],{"href":437},"eve agent",", the caller principal is the identity eve itself routes on:",[604,2131,2134],{"className":606,"code":2132,"filename":2133,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({ distinctIdField: 'eve.caller.principalId' })\n","agent\u002Fhooks\u002Fevlog.ts",[612,2135,2136],{"__ignoreMap":610},[615,2137,2138,2140,2142,2144,2146,2148,2150,2153,2155,2157,2160,2162,2164],{"class":617,"line":618},[615,2139,1484],{"class":780},[615,2141,1487],{"class":629},[615,2143,705],{"class":625},[615,2145,630],{"class":765},[615,2147,769],{"class":629},[615,2149,1007],{"class":625},[615,2151,2152],{"class":804}," distinctIdField",[615,2154,928],{"class":625},[615,2156,639],{"class":625},[615,2158,2159],{"class":642},"eve.caller.principalId",[615,2161,807],{"class":625},[615,2163,633],{"class":625},[615,2165,829],{"class":629},[536,2167,2168,2169,2171],{},"A static ",[612,2170,1597],{}," overrides the field lookup entirely — use it for a backend that acts as one identity rather than on behalf of users.",[1836,2173,2174,2175,2178,2179,672,2181,2183,2184,2186],{"color":1838,"icon":13},"PostHog matches the attribute value against every ",[612,2176,2177],{},"distinct_id"," it knows for a person, so any one of their identifiers works. The attribute key is configurable per project under ",[669,2180,671],{},[669,2182,1854],{}," — leave it at the default ",[612,2185,1761],{}," and this works out of the box.",[597,2188,2190],{"id":2189},"regions","Regions",[536,2192,2193,2194,2196],{},"PostHog offers US and EU cloud hosting. Set the ",[612,2195,1578],{}," to match your region:",[1335,2198,2199,2209],{},[1338,2200,2201],{},[1341,2202,2203,2206],{},[1344,2204,2205],{},"Region",[1344,2207,2208],{},"Host",[1351,2210,2211,2220,2229],{},[1341,2212,2213,2216],{},[1356,2214,2215],{},"US (default)",[1356,2217,2218],{},[612,2219,1587],{},[1341,2221,2222,2225],{},[1356,2223,2224],{},"EU",[1356,2226,2227],{},[612,2228,1507],{},[1341,2230,2231,2234],{},[1356,2232,2233],{},"Self-hosted",[1356,2235,2236],{},"Your instance URL",[604,2238,2240],{"className":692,"code":2239,"filename":694,"language":695,"meta":610,"style":610},"# EU region\nPOSTHOG_API_KEY=phc_xxx\nPOSTHOG_HOST=https:\u002F\u002Feu.i.posthog.com\n",[612,2241,2242,2247,2256],{"__ignoreMap":610},[615,2243,2244],{"class":617,"line":618},[615,2245,2246],{"class":726},"# EU region\n",[615,2248,2249,2251,2253],{"class":617,"line":730},[615,2250,702],{"class":629},[615,2252,705],{"class":625},[615,2254,2255],{"class":642},"phc_xxx\n",[615,2257,2258,2260,2262],{"class":617,"line":749},[615,2259,1371],{"class":629},[615,2261,705],{"class":625},[615,2263,2264],{"class":642},"https:\u002F\u002Feu.i.posthog.com\n",[597,2266,2268],{"id":2267},"querying-logs-in-posthog","Querying Logs in PostHog",[536,2270,2271,2272,2274],{},"Once your logs are flowing, use the ",[669,2273,1854],{}," tab in PostHog to query them:",[560,2276,2277,2282,2285],{},[563,2278,667,2279,2281],{},[669,2280,1854],{}," and filter by service, severity, or any structured attribute",[563,2283,2284],{},"Use the search bar to find specific log entries",[563,2286,2287],{},"Click on a log entry to see all structured attributes",[597,2289,2291],{"id":2290},"posthog-events-custom-events","PostHog Events (Custom Events)",[536,2293,2294,2295,2297,2298,928],{},"If you prefer sending logs as PostHog custom events (e.g., for product analytics, cohorts, or funnels), use ",[612,2296,1310],{}," with ",[612,2299,2300],{},"mode: 'events'",[604,2302,2304],{"className":606,"code":2303,"filename":1477,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\nconst drain = createPostHogDrain({\n  mode: 'events',\n  eventName: 'server_request',\n  distinctId: 'my-backend-service',\n})\n",[612,2305,2306,2324,2328,2342,2358,2374,2390],{"__ignoreMap":610},[615,2307,2308,2310,2312,2314,2316,2318,2320,2322],{"class":617,"line":618},[615,2309,622],{"class":621},[615,2311,626],{"class":625},[615,2313,630],{"class":629},[615,2315,633],{"class":625},[615,2317,636],{"class":621},[615,2319,639],{"class":625},[615,2321,643],{"class":642},[615,2323,646],{"class":625},[615,2325,2326],{"class":617,"line":730},[615,2327,753],{"emptyLinePlaceholder":752},[615,2329,2330,2332,2334,2336,2338,2340],{"class":617,"line":749},[615,2331,1484],{"class":780},[615,2333,1487],{"class":629},[615,2335,705],{"class":625},[615,2337,630],{"class":765},[615,2339,769],{"class":629},[615,2341,920],{"class":625},[615,2343,2344,2347,2349,2351,2354,2356],{"class":617,"line":756},[615,2345,2346],{"class":804},"  mode",[615,2348,928],{"class":625},[615,2350,639],{"class":625},[615,2352,2353],{"class":642},"events",[615,2355,807],{"class":625},[615,2357,938],{"class":625},[615,2359,2360,2363,2365,2367,2370,2372],{"class":617,"line":787},[615,2361,2362],{"class":804},"  eventName",[615,2364,928],{"class":625},[615,2366,639],{"class":625},[615,2368,2369],{"class":642},"server_request",[615,2371,807],{"class":625},[615,2373,938],{"class":625},[615,2375,2376,2379,2381,2383,2386,2388],{"class":617,"line":823},[615,2377,2378],{"class":804},"  distinctId",[615,2380,928],{"class":625},[615,2382,639],{"class":625},[615,2384,2385],{"class":642},"my-backend-service",[615,2387,807],{"class":625},[615,2389,938],{"class":625},[615,2391,2392,2394],{"class":617,"line":941},[615,2393,826],{"class":625},[615,2395,829],{"class":629},[536,2397,2398,2399,2402,2403,2406],{},"Then pass ",[612,2400,2401],{},"drain"," to your framework the same way as the default logs drain (see ",[539,2404,25],{"href":2405},"#quick-start"," above).",[1836,2408,2409,2410,2412],{"color":1838,"icon":13},"Custom events count towards your PostHog event quota. PostHog Logs (the default ",[612,2411,1310],{},") is significantly cheaper.",[1836,2414,2417,2420,2421,2424,2425,2428],{"color":2415,"icon":2416},"warning","i-lucide-triangle-alert",[669,2418,2419],{},"Legacy:"," ",[612,2422,2423],{},"createPostHogEventsDrain()"," is deprecated and re-routes to ",[612,2426,2427],{},"createPostHogDrain({ mode: 'events' })",". It will be removed in the next major release.",[651,2430,2432],{"id":2431},"events-configuration","Events Configuration",[1335,2434,2435,2447],{},[1338,2436,2437],{},[1341,2438,2439,2441,2443,2445],{},[1344,2440,1543],{},[1344,2442,1546],{},[1344,2444,1549],{},[1344,2446,1349],{},[1351,2448,2449,2463,2479,2498,2516,2536],{},[1341,2450,2451,2455,2459,2461],{},[1356,2452,2453],{},[612,2454,1560],{},[1356,2456,2457],{},[612,2458,1565],{},[1356,2460,1568],{},[1356,2462,1571],{},[1341,2464,2465,2469,2473,2477],{},[1356,2466,2467],{},[612,2468,1578],{},[1356,2470,2471],{},[612,2472,1565],{},[1356,2474,2475],{},[612,2476,1587],{},[1356,2478,1590],{},[1341,2480,2481,2486,2490,2495],{},[1356,2482,2483],{},[612,2484,2485],{},"eventName",[1356,2487,2488],{},[612,2489,1565],{},[1356,2491,2492],{},[612,2493,2494],{},"evlog_wide_event",[1356,2496,2497],{},"PostHog event name",[1341,2499,2500,2504,2508,2510],{},[1356,2501,2502],{},[612,2503,1597],{},[1356,2505,2506],{},[612,2507,1565],{},[1356,2509,1568],{},[1356,2511,2512,2513,2515],{},"Static ",[612,2514,2177],{}," for all events",[1341,2517,2518,2522,2526,2530],{},[1356,2519,2520],{},[612,2521,1613],{},[1356,2523,2524],{},[612,2525,1565],{},[1356,2527,2528],{},[612,2529,1622],{},[1356,2531,2532,2533,2535],{},"Event field holding the ",[612,2534,2177],{}," (dot path)",[1341,2537,2538,2542,2546,2550],{},[1356,2539,2540],{},[612,2541,1675],{},[1356,2543,2544],{},[612,2545,1680],{},[1356,2547,2548],{},[612,2549,1685],{},[1356,2551,1688],{},[651,2553,2555],{"id":2554},"event-format","Event Format",[536,2557,2558],{},"evlog maps wide events to PostHog events:",[1335,2560,2561,2571],{},[1338,2562,2563],{},[1341,2564,2565,2568],{},[1344,2566,2567],{},"evlog Field",[1344,2569,2570],{},"PostHog Field",[1351,2572,2573,2591,2602,2614,2625,2637],{},[1341,2574,2575,2586],{},[1356,2576,2577,2580,2581,2580,2583],{},[612,2578,2579],{},"config.distinctId"," or ",[612,2582,1622],{},[612,2584,2585],{},"service",[1356,2587,2588,2590],{},[612,2589,2177],{}," (fallback chain)",[1341,2592,2593,2598],{},[1356,2594,2595],{},[612,2596,2597],{},"timestamp",[1356,2599,2600],{},[612,2601,2597],{},[1341,2603,2604,2609],{},[1356,2605,2606],{},[612,2607,2608],{},"level",[1356,2610,2611],{},[612,2612,2613],{},"properties.level",[1341,2615,2616,2620],{},[1356,2617,2618],{},[612,2619,2585],{},[1356,2621,2622],{},[612,2623,2624],{},"properties.service",[1341,2626,2627,2632],{},[1356,2628,2629],{},[612,2630,2631],{},"environment",[1356,2633,2634],{},[612,2635,2636],{},"properties.environment",[1341,2638,2639,2642],{},[1356,2640,2641],{},"All other fields",[1356,2643,2644],{},[612,2645,2646],{},"properties.*",[651,2648,2650],{"id":2649},"distinct-id-resolution","Distinct ID Resolution",[536,2652,2653,2654,2656],{},"The ",[612,2655,2177],{}," follows a fallback chain:",[560,2658,2659,2668,2679],{},[563,2660,2661,2665,2666],{},[669,2662,2663],{},[612,2664,2579],{}," - explicit override in ",[612,2667,2427],{},[563,2669,2670,2675,2676,2678],{},[669,2671,2672],{},[612,2673,2674],{},"event.userId"," - or whatever ",[612,2677,1613],{}," points at, when it holds a string or a number",[563,2680,2681,2686],{},[669,2682,2683],{},[612,2684,2685],{},"event.service"," - final fallback, sent as an anonymous event",[651,2688,2690],{"id":2689},"identified-vs-anonymous-events","Identified vs Anonymous Events",[536,2692,2693,2694,2697],{},"An event that resolves to a real person is an ",[669,2695,2696],{},"identified"," event: PostHog creates a person profile for it and attaches person properties.",[536,2699,2700,2701,2704,2705,2708],{},"When no identifier resolves, the event is sent as ",[669,2702,2703],{},"anonymous"," — ",[612,2706,2707],{},"$process_person_profile: false"," — rather than piling every request onto one \"person\" named after your service. PostHog bills anonymous events at a lower rate and keeps them out of person profiles.",[604,2710,2712],{"className":606,"code":2711,"filename":1477,"language":609,"meta":610,"style":610},"\u002F\u002F Identified: events carrying `userId` create and update a person profile\nconst drain = createPostHogDrain({ mode: 'events' })\n\n\u002F\u002F Identified as one backend identity, whatever the request\nconst service = createPostHogDrain({ mode: 'events', distinctId: 'checkout-worker' })\n",[612,2713,2714,2719,2748,2752,2757],{"__ignoreMap":610},[615,2715,2716],{"class":617,"line":618},[615,2717,2718],{"class":726},"\u002F\u002F Identified: events carrying `userId` create and update a person profile\n",[615,2720,2721,2723,2725,2727,2729,2731,2733,2736,2738,2740,2742,2744,2746],{"class":617,"line":730},[615,2722,1484],{"class":780},[615,2724,1487],{"class":629},[615,2726,705],{"class":625},[615,2728,630],{"class":765},[615,2730,769],{"class":629},[615,2732,1007],{"class":625},[615,2734,2735],{"class":804}," mode",[615,2737,928],{"class":625},[615,2739,639],{"class":625},[615,2741,2353],{"class":642},[615,2743,807],{"class":625},[615,2745,633],{"class":625},[615,2747,829],{"class":629},[615,2749,2750],{"class":617,"line":749},[615,2751,753],{"emptyLinePlaceholder":752},[615,2753,2754],{"class":617,"line":756},[615,2755,2756],{"class":726},"\u002F\u002F Identified as one backend identity, whatever the request\n",[615,2758,2759,2761,2764,2766,2768,2770,2772,2774,2776,2778,2780,2782,2784,2787,2789,2791,2794,2796,2798],{"class":617,"line":787},[615,2760,1484],{"class":780},[615,2762,2763],{"class":629}," service ",[615,2765,705],{"class":625},[615,2767,630],{"class":765},[615,2769,769],{"class":629},[615,2771,1007],{"class":625},[615,2773,2735],{"class":804},[615,2775,928],{"class":625},[615,2777,639],{"class":625},[615,2779,2353],{"class":642},[615,2781,807],{"class":625},[615,2783,815],{"class":625},[615,2785,2786],{"class":804}," distinctId",[615,2788,928],{"class":625},[615,2790,639],{"class":625},[615,2792,2793],{"class":642},"checkout-worker",[615,2795,807],{"class":625},[615,2797,633],{"class":625},[615,2799,829],{"class":629},[1836,2801,2802],{"color":1838,"icon":13},"Anonymous events can be up to 4× cheaper than identified ones. Only set an identity on the events where you actually need per-person analysis.",[651,2804,2806],{"id":2805},"logs-vs-events","Logs vs Events",[1335,2808,2809,2823],{},[1338,2810,2811],{},[1341,2812,2813,2815,2819],{},[1344,2814],{},[1344,2816,2817],{},[612,2818,1310],{},[1344,2820,2821],{},[612,2822,2427],{},[1351,2824,2825,2843,2856,2869],{},[1341,2826,2827,2831,2837],{},[1356,2828,2829],{},[669,2830,1748],{},[1356,2832,2833,2834,685],{},"OTLP Logs (",[612,2835,2836],{},"\u002Fi\u002Fv1\u002Flogs",[1356,2838,2839,2840,685],{},"PostHog Events (",[612,2841,2842],{},"\u002Fbatch\u002F",[1341,2844,2845,2850,2853],{},[1356,2846,2847],{},[669,2848,2849],{},"PostHog UI",[1356,2851,2852],{},"Logs viewer",[1356,2854,2855],{},"Events explorer",[1341,2857,2858,2863,2866],{},[1356,2859,2860],{},[669,2861,2862],{},"Cost",[1356,2864,2865],{},"Lower (dedicated logs pipeline)",[1356,2867,2868],{},"Higher (counts as events)",[1341,2870,2871,2876,2879],{},[1356,2872,2873],{},[669,2874,2875],{},"Best for",[1356,2877,2878],{},"Debugging, log search, observability",[1356,2880,2881],{},"Product analytics, cohorts, funnels",[536,2883,2884],{},"You can use both drains simultaneously to get the best of both worlds:",[604,2886,2888],{"className":606,"code":2887,"filename":1477,"language":609,"meta":610,"style":610},"import { createPostHogDrain } from 'evlog\u002Fposthog'\n\nconst logs = createPostHogDrain()\nconst events = createPostHogDrain({ mode: 'events' })\n\nconst drain = async (ctx) => {\n  await Promise.allSettled([logs(ctx), events(ctx)])\n}\n",[612,2889,2890,2908,2912,2926,2955,2959,2981,3019],{"__ignoreMap":610},[615,2891,2892,2894,2896,2898,2900,2902,2904,2906],{"class":617,"line":618},[615,2893,622],{"class":621},[615,2895,626],{"class":625},[615,2897,630],{"class":629},[615,2899,633],{"class":625},[615,2901,636],{"class":621},[615,2903,639],{"class":625},[615,2905,643],{"class":642},[615,2907,646],{"class":625},[615,2909,2910],{"class":617,"line":730},[615,2911,753],{"emptyLinePlaceholder":752},[615,2913,2914,2916,2919,2921,2923],{"class":617,"line":749},[615,2915,1484],{"class":780},[615,2917,2918],{"class":629}," logs ",[615,2920,705],{"class":625},[615,2922,630],{"class":765},[615,2924,2925],{"class":629},"()\n",[615,2927,2928,2930,2933,2935,2937,2939,2941,2943,2945,2947,2949,2951,2953],{"class":617,"line":756},[615,2929,1484],{"class":780},[615,2931,2932],{"class":629}," events ",[615,2934,705],{"class":625},[615,2936,630],{"class":765},[615,2938,769],{"class":629},[615,2940,1007],{"class":625},[615,2942,2735],{"class":804},[615,2944,928],{"class":625},[615,2946,639],{"class":625},[615,2948,2353],{"class":642},[615,2950,807],{"class":625},[615,2952,633],{"class":625},[615,2954,829],{"class":629},[615,2956,2957],{"class":617,"line":787},[615,2958,753],{"emptyLinePlaceholder":752},[615,2960,2961,2963,2965,2967,2970,2972,2975,2977,2979],{"class":617,"line":823},[615,2962,1484],{"class":780},[615,2964,1487],{"class":629},[615,2966,705],{"class":625},[615,2968,2969],{"class":780}," async",[615,2971,1326],{"class":625},[615,2973,2974],{"class":774},"ctx",[615,2976,685],{"class":625},[615,2978,781],{"class":780},[615,2980,784],{"class":625},[615,2982,2983,2986,2990,2992,2995,2998,3001,3003,3005,3007,3009,3012,3014,3016],{"class":617,"line":941},[615,2984,2985],{"class":621},"  await",[615,2987,2989],{"class":2988},"sBMFI"," Promise",[615,2991,793],{"class":625},[615,2993,2994],{"class":765},"allSettled",[615,2996,2997],{"class":804},"([",[615,2999,3000],{"class":765},"logs",[615,3002,769],{"class":804},[615,3004,2974],{"class":629},[615,3006,685],{"class":804},[615,3008,815],{"class":625},[615,3010,3011],{"class":765}," events",[615,3013,769],{"class":804},[615,3015,2974],{"class":629},[615,3017,3018],{"class":804},")])\n",[615,3020,3021],{"class":617,"line":956},[615,3022,3023],{"class":625},"}\n",[597,3025,3027],{"id":3026},"troubleshooting","Troubleshooting",[651,3029,3031],{"id":3030},"missing-apikey-error","Missing apiKey error",[604,3033,3039],{"className":3034,"code":3036,"filename":3037,"language":3038,"meta":610},[3035],"language-text","[evlog\u002Fposthog] Missing apiKey. Set POSTHOG_API_KEY env var or pass to createPostHogDrain()\n","Console","text",[612,3040,3036],{"__ignoreMap":610},[536,3042,3043],{},"Make sure your environment variable is set and the server was restarted after adding it.",[651,3045,3047],{"id":3046},"events-not-appearing","Events not appearing",[536,3049,3050],{},"PostHog processes events asynchronously. There may be a short delay (typically under 1 minute) before events appear in the dashboard.",[560,3052,3053,3060,3065],{},[563,3054,3055,3056,3059],{},"Check the server console for ",[612,3057,3058],{},"[evlog\u002Fposthog]"," error messages",[563,3061,3062,3063],{},"Verify your API key is correct and starts with ",[612,3064,684],{},[563,3066,3067,3068,3070],{},"Confirm your ",[612,3069,1578],{}," matches your PostHog region (US vs EU)",[651,3072,3074],{"id":3073},"wrong-region","Wrong region",[536,3076,3077,3078,3080],{},"If you're on PostHog EU but using the default US host, event delivery will fail and the adapter will log errors (for example under ",[612,3079,3058],{},") to your server console. Set the correct host:",[604,3082,3084],{"className":692,"code":3083,"filename":694,"language":695,"meta":610,"style":610},"POSTHOG_HOST=https:\u002F\u002Feu.i.posthog.com\n",[612,3085,3086],{"__ignoreMap":610},[615,3087,3088,3090,3092],{"class":617,"line":618},[615,3089,1371],{"class":629},[615,3091,705],{"class":625},[615,3093,2264],{"class":642},[597,3095,3097],{"id":3096},"direct-api-usage","Direct API Usage",[536,3099,3100],{},"For advanced use cases, you can use the lower-level functions:",[604,3102,3105],{"className":606,"code":3103,"filename":3104,"language":609,"meta":610,"style":610},"import { sendToPostHog, sendBatchToPostHog } from 'evlog\u002Fposthog'\n\n\u002F\u002F Send a single event to PostHog Logs (OTLP)\nawait sendToPostHog(event, {\n  apiKey: 'phc_xxx',\n})\n\n\u002F\u002F Send multiple events in one request\nawait sendBatchToPostHog(events, {\n  apiKey: 'phc_xxx',\n})\n","server\u002Futils\u002Fposthog.ts",[612,3106,3107,3131,3135,3140,3153,3169,3175,3179,3184,3198,3213],{"__ignoreMap":610},[615,3108,3109,3111,3113,3116,3118,3121,3123,3125,3127,3129],{"class":617,"line":618},[615,3110,622],{"class":621},[615,3112,626],{"class":625},[615,3114,3115],{"class":629}," sendToPostHog",[615,3117,815],{"class":625},[615,3119,3120],{"class":629}," sendBatchToPostHog",[615,3122,633],{"class":625},[615,3124,636],{"class":621},[615,3126,639],{"class":625},[615,3128,643],{"class":642},[615,3130,646],{"class":625},[615,3132,3133],{"class":617,"line":730},[615,3134,753],{"emptyLinePlaceholder":752},[615,3136,3137],{"class":617,"line":749},[615,3138,3139],{"class":726},"\u002F\u002F Send a single event to PostHog Logs (OTLP)\n",[615,3141,3142,3144,3146,3149,3151],{"class":617,"line":756},[615,3143,1108],{"class":621},[615,3145,3115],{"class":765},[615,3147,3148],{"class":629},"(event",[615,3150,815],{"class":625},[615,3152,784],{"class":625},[615,3154,3155,3158,3160,3162,3165,3167],{"class":617,"line":787},[615,3156,3157],{"class":804},"  apiKey",[615,3159,928],{"class":625},[615,3161,639],{"class":625},[615,3163,3164],{"class":642},"phc_xxx",[615,3166,807],{"class":625},[615,3168,938],{"class":625},[615,3170,3171,3173],{"class":617,"line":823},[615,3172,826],{"class":625},[615,3174,829],{"class":629},[615,3176,3177],{"class":617,"line":941},[615,3178,753],{"emptyLinePlaceholder":752},[615,3180,3181],{"class":617,"line":956},[615,3182,3183],{"class":726},"\u002F\u002F Send multiple events in one request\n",[615,3185,3187,3189,3191,3194,3196],{"class":617,"line":3186},9,[615,3188,1108],{"class":621},[615,3190,3120],{"class":765},[615,3192,3193],{"class":629},"(events",[615,3195,815],{"class":625},[615,3197,784],{"class":625},[615,3199,3201,3203,3205,3207,3209,3211],{"class":617,"line":3200},10,[615,3202,3157],{"class":804},[615,3204,928],{"class":625},[615,3206,639],{"class":625},[615,3208,3164],{"class":642},[615,3210,807],{"class":625},[615,3212,938],{"class":625},[615,3214,3216,3218],{"class":617,"line":3215},11,[615,3217,826],{"class":625},[615,3219,829],{"class":629},[536,3221,3222],{},"For custom events, use the events-specific functions:",[604,3224,3226],{"className":606,"code":3225,"filename":3104,"language":609,"meta":610,"style":610},"import { sendToPostHogEvents, sendBatchToPostHogEvents, toPostHogEvent } from 'evlog\u002Fposthog'\n\n\u002F\u002F Send a single custom event\nawait sendToPostHogEvents(event, {\n  apiKey: 'phc_xxx',\n})\n\n\u002F\u002F Send multiple custom events in one request\nawait sendBatchToPostHogEvents(events, {\n  apiKey: 'phc_xxx',\n})\n\n\u002F\u002F Convert event to PostHog format (for inspection)\nconst posthogEvent = toPostHogEvent(event, { apiKey: 'phc_xxx' })\n",[612,3227,3228,3257,3261,3266,3278,3292,3298,3302,3307,3319,3333,3339,3344,3350],{"__ignoreMap":610},[615,3229,3230,3232,3234,3237,3239,3242,3244,3247,3249,3251,3253,3255],{"class":617,"line":618},[615,3231,622],{"class":621},[615,3233,626],{"class":625},[615,3235,3236],{"class":629}," sendToPostHogEvents",[615,3238,815],{"class":625},[615,3240,3241],{"class":629}," sendBatchToPostHogEvents",[615,3243,815],{"class":625},[615,3245,3246],{"class":629}," toPostHogEvent",[615,3248,633],{"class":625},[615,3250,636],{"class":621},[615,3252,639],{"class":625},[615,3254,643],{"class":642},[615,3256,646],{"class":625},[615,3258,3259],{"class":617,"line":730},[615,3260,753],{"emptyLinePlaceholder":752},[615,3262,3263],{"class":617,"line":749},[615,3264,3265],{"class":726},"\u002F\u002F Send a single custom event\n",[615,3267,3268,3270,3272,3274,3276],{"class":617,"line":756},[615,3269,1108],{"class":621},[615,3271,3236],{"class":765},[615,3273,3148],{"class":629},[615,3275,815],{"class":625},[615,3277,784],{"class":625},[615,3279,3280,3282,3284,3286,3288,3290],{"class":617,"line":787},[615,3281,3157],{"class":804},[615,3283,928],{"class":625},[615,3285,639],{"class":625},[615,3287,3164],{"class":642},[615,3289,807],{"class":625},[615,3291,938],{"class":625},[615,3293,3294,3296],{"class":617,"line":823},[615,3295,826],{"class":625},[615,3297,829],{"class":629},[615,3299,3300],{"class":617,"line":941},[615,3301,753],{"emptyLinePlaceholder":752},[615,3303,3304],{"class":617,"line":956},[615,3305,3306],{"class":726},"\u002F\u002F Send multiple custom events in one request\n",[615,3308,3309,3311,3313,3315,3317],{"class":617,"line":3186},[615,3310,1108],{"class":621},[615,3312,3241],{"class":765},[615,3314,3193],{"class":629},[615,3316,815],{"class":625},[615,3318,784],{"class":625},[615,3320,3321,3323,3325,3327,3329,3331],{"class":617,"line":3200},[615,3322,3157],{"class":804},[615,3324,928],{"class":625},[615,3326,639],{"class":625},[615,3328,3164],{"class":642},[615,3330,807],{"class":625},[615,3332,938],{"class":625},[615,3334,3335,3337],{"class":617,"line":3215},[615,3336,826],{"class":625},[615,3338,829],{"class":629},[615,3340,3342],{"class":617,"line":3341},12,[615,3343,753],{"emptyLinePlaceholder":752},[615,3345,3347],{"class":617,"line":3346},13,[615,3348,3349],{"class":726},"\u002F\u002F Convert event to PostHog format (for inspection)\n",[615,3351,3353,3355,3358,3360,3362,3364,3366,3368,3371,3373,3375,3377,3379,3381],{"class":617,"line":3352},14,[615,3354,1484],{"class":780},[615,3356,3357],{"class":629}," posthogEvent ",[615,3359,705],{"class":625},[615,3361,3246],{"class":765},[615,3363,3148],{"class":629},[615,3365,815],{"class":625},[615,3367,626],{"class":625},[615,3369,3370],{"class":804}," apiKey",[615,3372,928],{"class":625},[615,3374,639],{"class":625},[615,3376,3164],{"class":642},[615,3378,807],{"class":625},[615,3380,633],{"class":625},[615,3382,829],{"class":629},[597,3384,3386],{"id":3385},"next-steps","Next Steps",[1723,3388,3389,3395,3401,3407],{},[563,3390,3391,3394],{},[539,3392,3393],{"href":152},"Axiom Adapter"," - Send logs to Axiom",[563,3396,3397,3400],{},[539,3398,3399],{"href":192},"OTLP Adapter"," - Send logs via OpenTelemetry Protocol",[563,3402,3403,3406],{},[539,3404,3405],{"href":491},"Custom Adapters"," - Build your own adapter",[563,3408,3409,3411],{},[539,3410,517],{"href":518}," - Security and production tips",[3413,3414,3415],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":610,"searchDepth":730,"depth":730,"links":3417},[3418,3419,3424,3430,3431,3432,3435,3436,3437,3444,3449,3450],{"id":599,"depth":730,"text":20},{"id":649,"depth":730,"text":25,"children":3420},[3421,3422,3423],{"id":653,"depth":749,"text":654},{"id":688,"depth":749,"text":689},{"id":711,"depth":749,"text":712},{"id":1296,"depth":730,"text":504,"children":3425},[3426,3427,3428,3429],{"id":1332,"depth":749,"text":1333},{"id":1377,"depth":749,"text":1378},{"id":1469,"depth":749,"text":1470},{"id":1533,"depth":749,"text":1534},{"id":1710,"depth":730,"text":1711},{"id":1768,"depth":730,"text":1769},{"id":1847,"depth":730,"text":1848,"children":3433},[3434],{"id":2061,"depth":749,"text":2062},{"id":2189,"depth":730,"text":2190},{"id":2267,"depth":730,"text":2268},{"id":2290,"depth":730,"text":2291,"children":3438},[3439,3440,3441,3442,3443],{"id":2431,"depth":749,"text":2432},{"id":2554,"depth":749,"text":2555},{"id":2649,"depth":749,"text":2650},{"id":2689,"depth":749,"text":2690},{"id":2805,"depth":749,"text":2806},{"id":3026,"depth":730,"text":3027,"children":3445},[3446,3447,3448],{"id":3030,"depth":749,"text":3031},{"id":3046,"depth":749,"text":3047},{"id":3073,"depth":749,"text":3074},{"id":3096,"depth":730,"text":3097},{"id":3385,"depth":730,"text":3386},"Send wide events to PostHog Logs via OTLP for structured log querying, debugging, and observability in your PostHog dashboard.","md",[3454,3460],{"label":3455,"icon":3456,"to":662,"target":3457,"color":3458,"variant":3459},"PostHog Dashboard","i-lucide-external-link","_blank","neutral","subtle",{"label":3393,"icon":154,"to":152,"color":3458,"variant":3459},{},{"title":156,"icon":159},{"title":531,"description":3451},"5wCZBEy5craKcoF4a1hNoq-65Zyu9XKfbFZdlgLEN6o",[3466,3468],{"title":151,"path":152,"stem":153,"description":3467,"icon":154,"children":-1},"Send wide events to Axiom for powerful querying, dashboards, and alerting. Zero-config setup with environment variables and automatic batching.",{"title":161,"path":162,"stem":163,"description":3469,"icon":164,"children":-1},"Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables.",1786404239580]