[{"data":1,"prerenderedAt":3520},["ShallowReactive",2],{"navigation_docs":3,"-integrate-adapters-cloud-posthog":529,"-integrate-adapters-cloud-posthog-surround":3515},[4,29,76,122,304,436,495],{"title":5,"path":6,"stem":7,"children":8,"page":28},"Start","\u002Fstart","1.start",[9,13,18,23],{"title":10,"path":11,"stem":12},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":14,"path":15,"stem":16,"icon":17},"Why start with evlog","\u002Fstart\u002Fwhy-evlog","1.start\u002F2.why-evlog","i-lucide-rocket",{"title":19,"path":20,"stem":21,"icon":22},"Installation","\u002Fstart\u002Finstallation","1.start\u002F3.installation","i-lucide-download",{"title":24,"path":25,"stem":26,"icon":27},"Quick Start","\u002Fstart\u002Fquick-start","1.start\u002F4.quick-start","i-lucide-zap",false,{"title":30,"path":31,"stem":32,"children":33,"page":28},"Learn","\u002Flearn","2.learn",[34,38,43,48,53,58,62,67,72],{"title":35,"path":36,"stem":37},"Learn evlog","\u002Flearn\u002Foverview","2.learn\u002F0.overview",{"title":39,"path":40,"stem":41,"icon":42},"Simple Logging","\u002Flearn\u002Fsimple-logging","2.learn\u002F1.simple-logging","i-lucide-terminal",{"title":44,"path":45,"stem":46,"icon":47},"Wide Events","\u002Flearn\u002Fwide-events","2.learn\u002F2.wide-events","i-lucide-layers",{"title":49,"path":50,"stem":51,"icon":52},"Structured Errors","\u002Flearn\u002Fstructured-errors","2.learn\u002F3.structured-errors","i-lucide-shield-alert",{"title":54,"path":55,"stem":56,"icon":57},"Lifecycle","\u002Flearn\u002Flifecycle","2.learn\u002F4.lifecycle","i-lucide-arrow-right-left",{"title":59,"path":60,"stem":61},"Sampling","\u002Flearn\u002Fsampling","2.learn\u002F5.sampling",{"title":63,"path":64,"stem":65,"icon":66},"Auto-Redaction","\u002Flearn\u002Fredaction","2.learn\u002F6.redaction","i-lucide-eye-off",{"title":68,"path":69,"stem":70,"icon":71},"Typed Fields","\u002Flearn\u002Ftyped-fields","2.learn\u002F7.typed-fields","i-simple-icons-typescript",{"title":73,"path":74,"stem":75},"Catalogs","\u002Flearn\u002Fcatalogs","2.learn\u002F8.catalogs",{"title":77,"path":78,"stem":79,"children":80,"page":28},"CLI","\u002Fcli","3.cli",[81,85,90,95,99,103,108,113,118],{"title":82,"path":83,"stem":84},"evlog CLI","\u002Fcli\u002Foverview","3.cli\u002F0.overview",{"title":86,"path":87,"stem":88,"icon":89},"init","\u002Fcli\u002Finit","3.cli\u002F1.init","i-lucide-wand-sparkles",{"title":91,"path":92,"stem":93,"icon":94},"map","\u002Fcli\u002Fmap","3.cli\u002F2.map","i-lucide-radar",{"title":96,"path":97,"stem":98},"Map rules","\u002Fcli\u002Frules","3.cli\u002F3.rules",{"title":100,"path":101,"stem":102},"Map scoring","\u002Fcli\u002Fscoring","3.cli\u002F4.scoring",{"title":104,"path":105,"stem":106,"icon":107},"CI","\u002Fcli\u002Fci","3.cli\u002F5.ci","i-lucide-git-pull-request",{"title":109,"path":110,"stem":111,"icon":112},"doctor","\u002Fcli\u002Fdoctor","3.cli\u002F6.doctor","i-lucide-stethoscope",{"title":114,"path":115,"stem":116,"icon":117},"telemetry","\u002Fcli\u002Ftelemetry","3.cli\u002F7.telemetry","i-lucide-bar-chart-3",{"title":119,"path":120,"stem":121},"evlog agents","\u002Fcli\u002Fagents","3.cli\u002F8.agents",{"title":123,"path":124,"stem":125,"children":126,"page":28},"Integrate","\u002Fintegrate","4.integrate",[127,132,216],{"title":128,"path":129,"stem":130,"icon":131},"Overview","\u002Fintegrate\u002Foverview","4.integrate\u002F0.overview","i-lucide-plug",{"title":133,"path":134,"stem":135,"children":136,"page":28},"Adapters","\u002Fintegrate\u002Fadapters","4.integrate\u002Fadapters",[137,141,171,196],{"title":128,"path":138,"stem":139,"icon":140},"\u002Fintegrate\u002Fadapters\u002Foverview","4.integrate\u002Fadapters\u002F01.overview","i-lucide-list",{"title":142,"path":143,"stem":144,"children":145,"page":28},"Cloud","\u002Fintegrate\u002Fadapters\u002Fcloud","4.integrate\u002Fadapters\u002Fcloud",[146,151,156,161,166],{"title":147,"path":148,"stem":149,"icon":150},"Axiom","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Faxiom","4.integrate\u002Fadapters\u002Fcloud\u002F01.axiom","i-custom-axiom",{"title":152,"path":153,"stem":154,"icon":155},"PostHog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fposthog","4.integrate\u002Fadapters\u002Fcloud\u002F02.posthog","i-simple-icons-posthog",{"title":157,"path":158,"stem":159,"icon":160},"Sentry","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fsentry","4.integrate\u002Fadapters\u002Fcloud\u002F03.sentry","i-simple-icons-sentry",{"title":162,"path":163,"stem":164,"icon":165},"Better Stack","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fbetter-stack","4.integrate\u002Fadapters\u002Fcloud\u002F04.better-stack","i-simple-icons-betterstack",{"title":167,"path":168,"stem":169,"icon":170},"Datadog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fdatadog","4.integrate\u002Fadapters\u002Fcloud\u002F05.datadog","i-simple-icons-datadog",{"title":172,"path":173,"stem":174,"children":175,"page":28},"Cloud or Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fhybrid","4.integrate\u002Fadapters\u002Fhybrid",[176,181,186,191],{"title":177,"path":178,"stem":179,"icon":180},"Grafana Loki","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Floki","4.integrate\u002Fadapters\u002Fhybrid\u002F01.loki","i-simple-icons-grafana",{"title":182,"path":183,"stem":184,"icon":185},"ClickHouse","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fclickhouse","4.integrate\u002Fadapters\u002Fhybrid\u002F02.clickhouse","i-simple-icons-clickhouse",{"title":187,"path":188,"stem":189,"icon":190},"OTLP","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fotlp","4.integrate\u002Fadapters\u002Fhybrid\u002F03.otlp","i-simple-icons-opentelemetry",{"title":192,"path":193,"stem":194,"icon":195},"HyperDX","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fhyperdx","4.integrate\u002Fadapters\u002Fhybrid\u002F04.hyperdx","i-custom-hyperdx",{"title":197,"path":198,"stem":199,"children":200,"page":28},"Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fself-hosted","4.integrate\u002Fadapters\u002Fself-hosted",[201,206,211],{"title":202,"path":203,"stem":204,"icon":205},"File System","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Ffs","4.integrate\u002Fadapters\u002Fself-hosted\u002F01.fs","i-lucide-hard-drive",{"title":207,"path":208,"stem":209,"icon":210},"NuxtHub","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fnuxthub","4.integrate\u002Fadapters\u002Fself-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":212,"path":213,"stem":214,"icon":215},"Memory","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fmemory","4.integrate\u002Fadapters\u002Fself-hosted\u002F03.memory","i-lucide-cpu",{"title":217,"path":218,"stem":219,"children":220,"page":28},"Frameworks","\u002Fintegrate\u002Fframeworks","4.integrate\u002Fframeworks",[221,225,230,235,240,245,250,255,260,265,270,275,280,285,289,294,299],{"title":128,"path":222,"stem":223,"icon":224},"\u002Fintegrate\u002Fframeworks\u002Foverview","4.integrate\u002Fframeworks\u002F00.overview","i-lucide-layout-grid",{"title":226,"path":227,"stem":228,"icon":229},"Nuxt","\u002Fintegrate\u002Fframeworks\u002Fnuxt","4.integrate\u002Fframeworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":231,"path":232,"stem":233,"icon":234},"Next.js","\u002Fintegrate\u002Fframeworks\u002Fnextjs","4.integrate\u002Fframeworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":236,"path":237,"stem":238,"icon":239},"SvelteKit","\u002Fintegrate\u002Fframeworks\u002Fsveltekit","4.integrate\u002Fframeworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":241,"path":242,"stem":243,"icon":244},"Nitro","\u002Fintegrate\u002Fframeworks\u002Fnitro","4.integrate\u002Fframeworks\u002F04.nitro","i-custom-nitro",{"title":246,"path":247,"stem":248,"icon":249},"TanStack Start","\u002Fintegrate\u002Fframeworks\u002Ftanstack-start","4.integrate\u002Fframeworks\u002F05.tanstack-start","i-custom-tanstack",{"title":251,"path":252,"stem":253,"icon":254},"NestJS","\u002Fintegrate\u002Fframeworks\u002Fnestjs","4.integrate\u002Fframeworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":256,"path":257,"stem":258,"icon":259},"Express","\u002Fintegrate\u002Fframeworks\u002Fexpress","4.integrate\u002Fframeworks\u002F07.express","i-simple-icons-express",{"title":261,"path":262,"stem":263,"icon":264},"Hono","\u002Fintegrate\u002Fframeworks\u002Fhono","4.integrate\u002Fframeworks\u002F08.hono","i-simple-icons-hono",{"title":266,"path":267,"stem":268,"icon":269},"Fastify","\u002Fintegrate\u002Fframeworks\u002Ffastify","4.integrate\u002Fframeworks\u002F09.fastify","i-simple-icons-fastify",{"title":271,"path":272,"stem":273,"icon":274},"Elysia","\u002Fintegrate\u002Fframeworks\u002Felysia","4.integrate\u002Fframeworks\u002F10.elysia","i-custom-elysia",{"title":276,"path":277,"stem":278,"icon":279},"React Router","\u002Fintegrate\u002Fframeworks\u002Freact-router","4.integrate\u002Fframeworks\u002F11.react-router","i-custom-reactrouter",{"title":281,"path":282,"stem":283,"icon":284},"Cloudflare Workers","\u002Fintegrate\u002Fframeworks\u002Fcloudflare-workers","4.integrate\u002Fframeworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":286,"path":287,"stem":288,"icon":71},"Standalone","\u002Fintegrate\u002Fframeworks\u002Fstandalone","4.integrate\u002Fframeworks\u002F13.standalone",{"title":290,"path":291,"stem":292,"icon":293},"Astro","\u002Fintegrate\u002Fframeworks\u002Fastro","4.integrate\u002Fframeworks\u002F14.astro","i-simple-icons-astro",{"title":295,"path":296,"stem":297,"icon":298},"oRPC","\u002Fintegrate\u002Fframeworks\u002Forpc","4.integrate\u002Fframeworks\u002F15.orpc","i-lucide-network",{"title":300,"path":301,"stem":302,"icon":303},"AWS Lambda","\u002Fintegrate\u002Fframeworks\u002Faws-lambda","4.integrate\u002Fframeworks\u002F16.aws-lambda","i-custom-lambda",{"title":305,"path":306,"stem":307,"children":308,"page":28},"Use Cases","\u002Fuse-cases","5.use-cases",[309,312,317,346,374,407,427,432],{"title":305,"path":310,"stem":311},"\u002Fuse-cases\u002Foverview","5.use-cases\u002F0.overview",{"title":313,"path":314,"stem":315,"icon":316},"Client Logging","\u002Fuse-cases\u002Fclient-logging","5.use-cases\u002F1.client-logging","i-lucide-monitor",{"title":318,"icon":319,"path":320,"stem":321,"children":322,"page":28},"AI SDK","i-simple-icons-vercel","\u002Fuse-cases\u002Fai-sdk","5.use-cases\u002F2.ai-sdk",[323,326,331,336,341],{"title":128,"path":324,"stem":325,"icon":140},"\u002Fuse-cases\u002Fai-sdk\u002Foverview","5.use-cases\u002F2.ai-sdk\u002F01.overview",{"title":327,"path":328,"stem":329,"icon":330},"Usage","\u002Fuse-cases\u002Fai-sdk\u002Fusage","5.use-cases\u002F2.ai-sdk\u002F02.usage","i-lucide-code",{"title":332,"path":333,"stem":334,"icon":335},"Options","\u002Fuse-cases\u002Fai-sdk\u002Foptions","5.use-cases\u002F2.ai-sdk\u002F03.options","i-lucide-sliders",{"title":337,"path":338,"stem":339,"icon":340},"Metadata","\u002Fuse-cases\u002Fai-sdk\u002Fmetadata","5.use-cases\u002F2.ai-sdk\u002F04.metadata","i-lucide-database",{"title":342,"path":343,"stem":344,"icon":345},"Telemetry","\u002Fuse-cases\u002Fai-sdk\u002Ftelemetry","5.use-cases\u002F2.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":28},"Better Auth","i-simple-icons-betterauth","\u002Fuse-cases\u002Fbetter-auth","5.use-cases\u002F3.better-auth",[352,355,360,365,369],{"title":128,"path":353,"stem":354,"icon":140},"\u002Fuse-cases\u002Fbetter-auth\u002Foverview","5.use-cases\u002F3.better-auth\u002F01.overview",{"title":356,"path":357,"stem":358,"icon":359},"Identify User","\u002Fuse-cases\u002Fbetter-auth\u002Fidentify-user","5.use-cases\u002F3.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":361,"path":362,"stem":363,"icon":364},"Middleware","\u002Fuse-cases\u002Fbetter-auth\u002Fmiddleware","5.use-cases\u002F3.better-auth\u002F03.middleware","i-lucide-shield",{"title":366,"path":367,"stem":368,"icon":316},"Client Sync","\u002Fuse-cases\u002Fbetter-auth\u002Fclient-sync","5.use-cases\u002F3.better-auth\u002F04.client-sync",{"title":370,"path":371,"stem":372,"icon":373},"Performance","\u002Fuse-cases\u002Fbetter-auth\u002Fperformance","5.use-cases\u002F3.better-auth\u002F05.performance","i-lucide-gauge",{"title":375,"icon":376,"path":377,"stem":378,"children":379,"page":28},"Audit Logs","i-lucide-shield-check","\u002Fuse-cases\u002Faudit","5.use-cases\u002F4.audit",[380,383,388,393,398,402],{"title":128,"path":381,"stem":382,"icon":140},"\u002Fuse-cases\u002Faudit\u002Foverview","5.use-cases\u002F4.audit\u002F01.overview",{"title":384,"path":385,"stem":386,"icon":387},"Schema","\u002Fuse-cases\u002Faudit\u002Fschema","5.use-cases\u002F4.audit\u002F02.schema","i-lucide-file-text",{"title":389,"path":390,"stem":391,"icon":392},"Recording","\u002Fuse-cases\u002Faudit\u002Frecording","5.use-cases\u002F4.audit\u002F03.recording","i-lucide-pen-line",{"title":394,"path":395,"stem":396,"icon":397},"Drains","\u002Fuse-cases\u002Faudit\u002Fpipeline","5.use-cases\u002F4.audit\u002F04.pipeline","i-lucide-link",{"title":399,"path":400,"stem":401,"icon":376},"Compliance","\u002Fuse-cases\u002Faudit\u002Fcompliance","5.use-cases\u002F4.audit\u002F05.compliance",{"title":403,"path":404,"stem":405,"icon":406},"Recipes","\u002Fuse-cases\u002Faudit\u002Frecipes","5.use-cases\u002F4.audit\u002F06.recipes","i-lucide-book-open",{"title":342,"icon":373,"path":408,"stem":409,"children":410,"page":28},"\u002Fuse-cases\u002Ftelemetry","5.use-cases\u002F4.telemetry",[411,414,419,423],{"title":128,"path":412,"stem":413,"icon":140},"\u002Fuse-cases\u002Ftelemetry\u002Foverview","5.use-cases\u002F4.telemetry\u002F01.overview",{"title":415,"path":416,"stem":417,"icon":418},"Setup","\u002Fuse-cases\u002Ftelemetry\u002Fsetup","5.use-cases\u002F4.telemetry\u002F02.setup","i-lucide-wrench",{"title":420,"path":421,"stem":422},"Telemetry Ingest","\u002Fuse-cases\u002Ftelemetry\u002Fingest","5.use-cases\u002F4.telemetry\u002F03.ingest",{"title":424,"path":425,"stem":426,"icon":406},"Reference","\u002Fuse-cases\u002Ftelemetry\u002Freference","5.use-cases\u002F4.telemetry\u002F04.reference",{"title":428,"path":429,"stem":430,"icon":431},"Enrichers","\u002Fuse-cases\u002Fenrichers","5.use-cases\u002F5.enrichers","i-lucide-sparkles",{"title":433,"path":434,"stem":435},"eve","\u002Fuse-cases\u002Feve","5.use-cases\u002F5.eve",{"title":437,"path":438,"stem":439,"children":440,"page":28},"Extend","\u002Fextend","6.extend",[441,445,450,455,459,464,468,472,476,481,486,491],{"title":128,"path":442,"stem":443,"icon":444},"\u002Fextend\u002Foverview","6.extend\u002F0.overview","i-lucide-blocks",{"title":446,"path":447,"stem":448,"icon":449},"Stream","\u002Fextend\u002Fstream","6.extend\u002F1.stream","i-lucide-radio-tower",{"title":451,"path":452,"stem":453,"icon":454},"Custom framework","\u002Fextend\u002Fcustom-framework","6.extend\u002F10.custom-framework","i-lucide-puzzle",{"title":456,"path":457,"stem":458,"icon":449},"Diagnostics channel","\u002Fextend\u002Fdiagnostics-channel","6.extend\u002F11.diagnostics-channel",{"title":460,"path":461,"stem":462,"icon":463},"FS reader","\u002Fextend\u002Ffs-reader","6.extend\u002F2.fs-reader","i-lucide-folder-search",{"title":403,"path":465,"stem":466,"icon":467},"\u002Fextend\u002Fconsumer-recipes","6.extend\u002F3.consumer-recipes","i-lucide-chef-hat",{"title":469,"path":470,"stem":471},"Plugins","\u002Fextend\u002Fplugins","6.extend\u002F4.plugins",{"title":473,"path":474,"stem":475,"icon":431},"Custom enrichers","\u002Fextend\u002Fcustom-enrichers","6.extend\u002F5.custom-enrichers",{"title":477,"path":478,"stem":479,"icon":480},"Tail sampling","\u002Fextend\u002Ftail-sampling","6.extend\u002F6.tail-sampling","i-lucide-filter",{"title":482,"path":483,"stem":484,"icon":485},"Identity headers","\u002Fextend\u002Fidentity-headers","6.extend\u002F7.identity-headers","i-lucide-fingerprint",{"title":487,"path":488,"stem":489,"icon":490},"Custom drains","\u002Fextend\u002Fcustom-drains","6.extend\u002F8.custom-drains","i-lucide-share-2",{"title":492,"path":493,"stem":494},"Drain Pipeline","\u002Fextend\u002Fdrain-pipeline","6.extend\u002F9.drain-pipeline",{"title":424,"path":496,"stem":497,"children":498,"page":28},"\u002Freference","7.reference",[499,504,507,512,516,521,525],{"title":500,"path":501,"stem":502,"icon":503},"Configuration","\u002Freference\u002Fconfiguration","7.reference\u002F1.configuration","i-lucide-settings",{"title":370,"path":505,"stem":506,"icon":373},"\u002Freference\u002Fperformance","7.reference\u002F2.performance",{"title":508,"path":509,"stem":510,"icon":511},"Vite Plugin","\u002Freference\u002Fvite-plugin","7.reference\u002F3.vite-plugin","i-custom-vite",{"title":513,"path":514,"stem":515,"icon":376},"Best Practices","\u002Freference\u002Fbest-practices","7.reference\u002F4.best-practices",{"title":517,"path":518,"stem":519,"icon":520},"vs Other Loggers","\u002Freference\u002Fvs-other-loggers","7.reference\u002F5.vs-other-loggers","i-lucide-scale",{"title":522,"path":523,"stem":524,"icon":431},"Agent Skills","\u002Freference\u002Fagent-skills","7.reference\u002F6.agent-skills",{"title":526,"path":527,"stem":528},"Log cost","\u002Freference\u002Fcost","7.reference\u002F7.cost",{"id":530,"title":531,"body":532,"description":3501,"extension":3502,"links":3503,"meta":3511,"navigation":3512,"path":153,"seo":3513,"stem":154,"__hash__":3514},"docs\u002F4.integrate\u002Fadapters\u002Fcloud\u002F02.posthog.md","PostHog Adapter",{"type":533,"value":534,"toc":3466},"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,1846,1850,1857,1866,1949,1956,2060,2064,2067,2124,2131,2167,2173,2188,2192,2198,2238,2266,2270,2276,2289,2293,2302,2397,2408,2414,2430,2434,2576,2580,2583,2671,2698,2702,2708,2738,2742,2749,2759,2850,2853,2857,2932,2935,3074,3078,3082,3091,3094,3098,3101,3121,3125,3131,3144,3148,3151,3270,3273,3433,3437,3462],[536,537,538,544,545,550],"p",{},[539,540,152],"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":155},"[\"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,19],"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,24],{"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":231,"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":261,"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":256,"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":266,"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":271,"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":251,"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":286,"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,500],{"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},"#choose-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},"what-happens-between-a-log-and-posthog","What happens between a log and PostHog",[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},"choose-a-record-shape","Choose 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,1840,1842,1843,1845],"callout",{"color":1838,"icon":1839},"info","i-lucide-info",[612,1841,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,1844,1775],{}," shape.",[597,1847,1849],{"id":1848},"link-a-log-to-a-person-and-a-session-replay","Link a log to a person and a session replay",[536,1851,1852,1853,1856],{},"A log that carries a person identifier shows up on that person's profile in PostHog, under the ",[669,1854,1855],{},"Logs"," tab, with 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,1858,1859,1860,1862,1863,1865],{},"PostHog reads both from log attributes: ",[612,1861,1761],{}," for the person, ",[612,1864,1641],{}," for the replay. The adapter fills them from your wide event, so this works as soon as your event carries the values:",[604,1867,1870],{"className":606,"code":1868,"filename":1869,"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,1871,1872,1886,1890,1904,1924,1943],{"__ignoreMap":610},[615,1873,1874,1876,1879,1881,1883],{"class":617,"line":618},[615,1875,1484],{"class":780},[615,1877,1878],{"class":629}," log ",[615,1880,705],{"class":625},[615,1882,898],{"class":765},[615,1884,1885],{"class":629},"(event)\n",[615,1887,1888],{"class":617,"line":730},[615,1889,753],{"emptyLinePlaceholder":752},[615,1891,1892,1895,1897,1900,1902],{"class":617,"line":749},[615,1893,1894],{"class":629},"log",[615,1896,793],{"class":625},[615,1898,1899],{"class":765},"set",[615,1901,769],{"class":629},[615,1903,920],{"class":625},[615,1905,1906,1909,1911,1914,1916,1919,1921],{"class":617,"line":756},[615,1907,1908],{"class":804},"  userId",[615,1910,928],{"class":625},[615,1912,1913],{"class":629}," user",[615,1915,793],{"class":625},[615,1917,1918],{"class":629},"id",[615,1920,815],{"class":625},[615,1922,1923],{"class":726}," \u002F\u002F → posthogDistinctId, links to the person\n",[615,1925,1926,1929,1931,1934,1936,1938,1940],{"class":617,"line":787},[615,1927,1928],{"class":804},"  sessionId",[615,1930,928],{"class":625},[615,1932,1933],{"class":629}," body",[615,1935,793],{"class":625},[615,1937,1641],{"class":629},[615,1939,815],{"class":625},[615,1941,1942],{"class":726}," \u002F\u002F → sessionId, links to the session replay\n",[615,1944,1945,1947],{"class":617,"line":823},[615,1946,826],{"class":625},[615,1948,829],{"class":629},[536,1950,1951,1952,1955],{},"The session id comes from the frontend. Read it with ",[612,1953,1954],{},"posthog.get_session_id()"," and send it along with the request:",[604,1957,1960],{"className":606,"code":1958,"filename":1959,"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,1961,1962,1979,1983,2003,2019,2054],{"__ignoreMap":610},[615,1963,1964,1966,1969,1972,1974,1977],{"class":617,"line":618},[615,1965,622],{"class":621},[615,1967,1968],{"class":629}," posthog ",[615,1970,1971],{"class":621},"from",[615,1973,639],{"class":625},[615,1975,1976],{"class":642},"posthog-js",[615,1978,646],{"class":625},[615,1980,1981],{"class":617,"line":730},[615,1982,753],{"emptyLinePlaceholder":752},[615,1984,1985,1987,1990,1992,1994,1997,1999,2001],{"class":617,"line":749},[615,1986,1108],{"class":621},[615,1988,1989],{"class":765}," $fetch",[615,1991,769],{"class":629},[615,1993,807],{"class":625},[615,1995,1996],{"class":642},"\u002Fapi\u002Fcheckout",[615,1998,807],{"class":625},[615,2000,815],{"class":625},[615,2002,784],{"class":625},[615,2004,2005,2008,2010,2012,2015,2017],{"class":617,"line":756},[615,2006,2007],{"class":804},"  method",[615,2009,928],{"class":625},[615,2011,639],{"class":625},[615,2013,2014],{"class":642},"POST",[615,2016,807],{"class":625},[615,2018,938],{"class":625},[615,2020,2021,2024,2026,2028,2031,2034,2036,2039,2041,2044,2046,2049,2051],{"class":617,"line":787},[615,2022,2023],{"class":804},"  body",[615,2025,928],{"class":625},[615,2027,626],{"class":625},[615,2029,2030],{"class":625}," ...",[615,2032,2033],{"class":629},"payload",[615,2035,815],{"class":625},[615,2037,2038],{"class":804}," sessionId",[615,2040,928],{"class":625},[615,2042,2043],{"class":629}," posthog",[615,2045,793],{"class":625},[615,2047,2048],{"class":765},"get_session_id",[615,2050,1017],{"class":629},[615,2052,2053],{"class":625},"},\n",[615,2055,2056,2058],{"class":617,"line":823},[615,2057,826],{"class":625},[615,2059,829],{"class":629},[651,2061,2063],{"id":2062},"point-at-your-own-fields","Point at your own fields",[536,2065,2066],{},"When identity lives somewhere else on your events, point the adapter at it. Both options take a dot path:",[604,2068,2070],{"className":606,"code":2069,"filename":1477,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({\n  distinctIdField: 'user.id',\n  sessionIdField: 'session.id',\n})\n",[612,2071,2072,2086,2102,2118],{"__ignoreMap":610},[615,2073,2074,2076,2078,2080,2082,2084],{"class":617,"line":618},[615,2075,1484],{"class":780},[615,2077,1487],{"class":629},[615,2079,705],{"class":625},[615,2081,630],{"class":765},[615,2083,769],{"class":629},[615,2085,920],{"class":625},[615,2087,2088,2091,2093,2095,2098,2100],{"class":617,"line":730},[615,2089,2090],{"class":804},"  distinctIdField",[615,2092,928],{"class":625},[615,2094,639],{"class":625},[615,2096,2097],{"class":642},"user.id",[615,2099,807],{"class":625},[615,2101,938],{"class":625},[615,2103,2104,2107,2109,2111,2114,2116],{"class":617,"line":749},[615,2105,2106],{"class":804},"  sessionIdField",[615,2108,928],{"class":625},[615,2110,639],{"class":625},[615,2112,2113],{"class":642},"session.id",[615,2115,807],{"class":625},[615,2117,938],{"class":625},[615,2119,2120,2122],{"class":617,"line":756},[615,2121,826],{"class":625},[615,2123,829],{"class":629},[536,2125,2126,2127,2130],{},"For an ",[539,2128,2129],{"href":434},"eve agent",", the caller principal is the identity eve itself routes on:",[604,2132,2135],{"className":606,"code":2133,"filename":2134,"language":609,"meta":610,"style":610},"const drain = createPostHogDrain({ distinctIdField: 'eve.caller.principalId' })\n","agent\u002Fhooks\u002Fevlog.ts",[612,2136,2137],{"__ignoreMap":610},[615,2138,2139,2141,2143,2145,2147,2149,2151,2154,2156,2158,2161,2163,2165],{"class":617,"line":618},[615,2140,1484],{"class":780},[615,2142,1487],{"class":629},[615,2144,705],{"class":625},[615,2146,630],{"class":765},[615,2148,769],{"class":629},[615,2150,1007],{"class":625},[615,2152,2153],{"class":804}," distinctIdField",[615,2155,928],{"class":625},[615,2157,639],{"class":625},[615,2159,2160],{"class":642},"eve.caller.principalId",[615,2162,807],{"class":625},[615,2164,633],{"class":625},[615,2166,829],{"class":629},[536,2168,2169,2170,2172],{},"A static ",[612,2171,1597],{}," overrides the field lookup entirely. Use it for a backend that acts as one identity rather than on behalf of users.",[1836,2174,2175,2176,2179,2180,672,2182,2184,2185,2187],{"color":1838,"icon":1839},"PostHog matches the attribute value against every ",[612,2177,2178],{},"distinct_id"," it knows for a person, so any one of their identifiers works. The attribute key is configurable per project under ",[669,2181,671],{},[669,2183,1855],{},". Leave it at the default ",[612,2186,1761],{}," and this works out of the box.",[597,2189,2191],{"id":2190},"regions","Regions",[536,2193,2194,2195,2197],{},"PostHog offers US and EU cloud hosting. Set the ",[612,2196,1578],{}," to match your region:",[1335,2199,2200,2210],{},[1338,2201,2202],{},[1341,2203,2204,2207],{},[1344,2205,2206],{},"Region",[1344,2208,2209],{},"Host",[1351,2211,2212,2221,2230],{},[1341,2213,2214,2217],{},[1356,2215,2216],{},"US (default)",[1356,2218,2219],{},[612,2220,1587],{},[1341,2222,2223,2226],{},[1356,2224,2225],{},"EU",[1356,2227,2228],{},[612,2229,1507],{},[1341,2231,2232,2235],{},[1356,2233,2234],{},"Self-hosted",[1356,2236,2237],{},"Your instance URL",[604,2239,2241],{"className":692,"code":2240,"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,2242,2243,2248,2257],{"__ignoreMap":610},[615,2244,2245],{"class":617,"line":618},[615,2246,2247],{"class":726},"# EU region\n",[615,2249,2250,2252,2254],{"class":617,"line":730},[615,2251,702],{"class":629},[615,2253,705],{"class":625},[615,2255,2256],{"class":642},"phc_xxx\n",[615,2258,2259,2261,2263],{"class":617,"line":749},[615,2260,1371],{"class":629},[615,2262,705],{"class":625},[615,2264,2265],{"class":642},"https:\u002F\u002Feu.i.posthog.com\n",[597,2267,2269],{"id":2268},"query-the-logs-in-posthog","Query the logs in PostHog",[536,2271,2272,2273,2275],{},"Once your logs are flowing, use the ",[669,2274,1855],{}," tab in PostHog to query them:",[560,2277,2278,2283,2286],{},[563,2279,667,2280,2282],{},[669,2281,1855],{}," and filter by service, severity, or any structured attribute",[563,2284,2285],{},"Use the search bar to find specific log entries",[563,2287,2288],{},"Click on a log entry to see all structured attributes",[597,2290,2292],{"id":2291},"send-custom-events-alongside-logs","Send custom events alongside logs",[536,2294,2295,2296,2298,2299,928],{},"If you prefer sending logs as PostHog custom events (e.g., for product analytics, cohorts, or funnels), use ",[612,2297,1310],{}," with ",[612,2300,2301],{},"mode: 'events'",[604,2303,2305],{"className":606,"code":2304,"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,2306,2307,2325,2329,2343,2359,2375,2391],{"__ignoreMap":610},[615,2308,2309,2311,2313,2315,2317,2319,2321,2323],{"class":617,"line":618},[615,2310,622],{"class":621},[615,2312,626],{"class":625},[615,2314,630],{"class":629},[615,2316,633],{"class":625},[615,2318,636],{"class":621},[615,2320,639],{"class":625},[615,2322,643],{"class":642},[615,2324,646],{"class":625},[615,2326,2327],{"class":617,"line":730},[615,2328,753],{"emptyLinePlaceholder":752},[615,2330,2331,2333,2335,2337,2339,2341],{"class":617,"line":749},[615,2332,1484],{"class":780},[615,2334,1487],{"class":629},[615,2336,705],{"class":625},[615,2338,630],{"class":765},[615,2340,769],{"class":629},[615,2342,920],{"class":625},[615,2344,2345,2348,2350,2352,2355,2357],{"class":617,"line":756},[615,2346,2347],{"class":804},"  mode",[615,2349,928],{"class":625},[615,2351,639],{"class":625},[615,2353,2354],{"class":642},"events",[615,2356,807],{"class":625},[615,2358,938],{"class":625},[615,2360,2361,2364,2366,2368,2371,2373],{"class":617,"line":787},[615,2362,2363],{"class":804},"  eventName",[615,2365,928],{"class":625},[615,2367,639],{"class":625},[615,2369,2370],{"class":642},"server_request",[615,2372,807],{"class":625},[615,2374,938],{"class":625},[615,2376,2377,2380,2382,2384,2387,2389],{"class":617,"line":823},[615,2378,2379],{"class":804},"  distinctId",[615,2381,928],{"class":625},[615,2383,639],{"class":625},[615,2385,2386],{"class":642},"my-backend-service",[615,2388,807],{"class":625},[615,2390,938],{"class":625},[615,2392,2393,2395],{"class":617,"line":941},[615,2394,826],{"class":625},[615,2396,829],{"class":629},[536,2398,2399,2400,2403,2404,2407],{},"Then pass ",[612,2401,2402],{},"drain"," to your framework the same way as the default logs drain (see ",[539,2405,24],{"href":2406},"#quick-start"," above).",[1836,2409,2410,2411,2413],{"color":1838,"icon":1839},"Custom events count towards your PostHog event quota. PostHog Logs (the default ",[612,2412,1310],{},") is significantly cheaper.",[1836,2415,2418,2421,2422,2425,2426,2429],{"color":2416,"icon":2417},"warning","i-lucide-triangle-alert",[669,2419,2420],{},"Legacy:"," ",[612,2423,2424],{},"createPostHogEventsDrain()"," is deprecated and re-routes to ",[612,2427,2428],{},"createPostHogDrain({ mode: 'events' })",". It will be removed in the next major release.",[651,2431,2433],{"id":2432},"configure-which-events-go-out","Configure which events go out",[1335,2435,2436,2448],{},[1338,2437,2438],{},[1341,2439,2440,2442,2444,2446],{},[1344,2441,1543],{},[1344,2443,1546],{},[1344,2445,1549],{},[1344,2447,1349],{},[1351,2449,2450,2464,2480,2499,2517,2537,2560],{},[1341,2451,2452,2456,2460,2462],{},[1356,2453,2454],{},[612,2455,1560],{},[1356,2457,2458],{},[612,2459,1565],{},[1356,2461,1568],{},[1356,2463,1571],{},[1341,2465,2466,2470,2474,2478],{},[1356,2467,2468],{},[612,2469,1578],{},[1356,2471,2472],{},[612,2473,1565],{},[1356,2475,2476],{},[612,2477,1587],{},[1356,2479,1590],{},[1341,2481,2482,2487,2491,2496],{},[1356,2483,2484],{},[612,2485,2486],{},"eventName",[1356,2488,2489],{},[612,2490,1565],{},[1356,2492,2493],{},[612,2494,2495],{},"evlog_wide_event",[1356,2497,2498],{},"PostHog event name",[1341,2500,2501,2505,2509,2511],{},[1356,2502,2503],{},[612,2504,1597],{},[1356,2506,2507],{},[612,2508,1565],{},[1356,2510,1568],{},[1356,2512,2513,2514,2516],{},"Static ",[612,2515,2178],{}," for all events",[1341,2518,2519,2523,2527,2531],{},[1356,2520,2521],{},[612,2522,1613],{},[1356,2524,2525],{},[612,2526,1565],{},[1356,2528,2529],{},[612,2530,1622],{},[1356,2532,2533,2534,2536],{},"Event field holding the ",[612,2535,2178],{}," (dot path)",[1341,2538,2539,2543,2547,2551],{},[1356,2540,2541],{},[612,2542,1651],{},[1356,2544,2545],{},[612,2546,1656],{},[1356,2548,2549],{},[612,2550,1661],{},[1356,2552,2553,2554,2556,2557,685],{},"Event property shape: ",[612,2555,1789],{}," flattens nested fields (see ",[539,2558,1668],{"href":2559},"#event-format",[1341,2561,2562,2566,2570,2574],{},[1356,2563,2564],{},[612,2565,1675],{},[1356,2567,2568],{},[612,2569,1680],{},[1356,2571,2572],{},[612,2573,1685],{},[1356,2575,1688],{},[651,2577,2579],{"id":2578},"event-format","Event Format",[536,2581,2582],{},"evlog maps wide events to PostHog events:",[1335,2584,2585,2595],{},[1338,2586,2587],{},[1341,2588,2589,2592],{},[1344,2590,2591],{},"evlog Field",[1344,2593,2594],{},"PostHog Field",[1351,2596,2597,2615,2626,2638,2649,2661],{},[1341,2598,2599,2610],{},[1356,2600,2601,2604,2605,2604,2607],{},[612,2602,2603],{},"config.distinctId"," or ",[612,2606,1622],{},[612,2608,2609],{},"service",[1356,2611,2612,2614],{},[612,2613,2178],{}," (fallback chain)",[1341,2616,2617,2622],{},[1356,2618,2619],{},[612,2620,2621],{},"timestamp",[1356,2623,2624],{},[612,2625,2621],{},[1341,2627,2628,2633],{},[1356,2629,2630],{},[612,2631,2632],{},"level",[1356,2634,2635],{},[612,2636,2637],{},"properties.level",[1341,2639,2640,2644],{},[1356,2641,2642],{},[612,2643,2609],{},[1356,2645,2646],{},[612,2647,2648],{},"properties.service",[1341,2650,2651,2656],{},[1356,2652,2653],{},[612,2654,2655],{},"environment",[1356,2657,2658],{},[612,2659,2660],{},"properties.environment",[1341,2662,2663,2666],{},[1356,2664,2665],{},"All other fields",[1356,2667,2668],{},[612,2669,2670],{},"properties.*",[536,2672,2673,2674,2677,2678,2680,2681,1762,2684,2687,2688,2691,2692,2694,2695,2697],{},"With ",[612,2675,2676],{},"recordShape: 'compact'",", the other fields are flattened into dotted keys the same way as in logs mode: a nested ",[612,2679,1779],{}," object arrives as ",[612,2682,2683],{},"properties.ai.costUsd",[612,2685,2686],{},"properties.ai.calls"," instead of one opaque ",[612,2689,2690],{},"properties.ai"," value. PostHog can filter and break down on those individual properties; the default ",[612,2693,1775],{}," shape keeps the nested object as a single serialized property. See ",[539,2696,1769],{"href":1667}," for the trade-off and how it affects your saved views and alerts.",[651,2699,2701],{"id":2700},"how-the-distinct-id-is-resolved","How the distinct ID is resolved",[536,2703,2704,2705,2707],{},"The ",[612,2706,2178],{}," follows a fallback chain:",[560,2709,2710,2719,2730],{},[563,2711,2712,2716,2717],{},[669,2713,2714],{},[612,2715,2603],{}," - explicit override in ",[612,2718,2428],{},[563,2720,2721,2726,2727,2729],{},[669,2722,2723],{},[612,2724,2725],{},"event.userId"," - or whatever ",[612,2728,1613],{}," points at, when it holds a string or a number",[563,2731,2732,2737],{},[669,2733,2734],{},[612,2735,2736],{},"event.service"," - final fallback, sent as an anonymous event",[651,2739,2741],{"id":2740},"identified-and-anonymous-events","Identified and anonymous events",[536,2743,2744,2745,2748],{},"An event that resolves to a real person is an ",[669,2746,2747],{},"identified"," event: PostHog creates a person profile for it and attaches person properties.",[536,2750,2751,2752,1326,2755,2758],{},"When no identifier resolves, the event is sent as ",[669,2753,2754],{},"anonymous",[612,2756,2757],{},"$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,2760,2762],{"className":606,"code":2761,"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,2763,2764,2769,2798,2802,2807],{"__ignoreMap":610},[615,2765,2766],{"class":617,"line":618},[615,2767,2768],{"class":726},"\u002F\u002F Identified: events carrying `userId` create and update a person profile\n",[615,2770,2771,2773,2775,2777,2779,2781,2783,2786,2788,2790,2792,2794,2796],{"class":617,"line":730},[615,2772,1484],{"class":780},[615,2774,1487],{"class":629},[615,2776,705],{"class":625},[615,2778,630],{"class":765},[615,2780,769],{"class":629},[615,2782,1007],{"class":625},[615,2784,2785],{"class":804}," mode",[615,2787,928],{"class":625},[615,2789,639],{"class":625},[615,2791,2354],{"class":642},[615,2793,807],{"class":625},[615,2795,633],{"class":625},[615,2797,829],{"class":629},[615,2799,2800],{"class":617,"line":749},[615,2801,753],{"emptyLinePlaceholder":752},[615,2803,2804],{"class":617,"line":756},[615,2805,2806],{"class":726},"\u002F\u002F Identified as one backend identity, whatever the request\n",[615,2808,2809,2811,2814,2816,2818,2820,2822,2824,2826,2828,2830,2832,2834,2837,2839,2841,2844,2846,2848],{"class":617,"line":787},[615,2810,1484],{"class":780},[615,2812,2813],{"class":629}," service ",[615,2815,705],{"class":625},[615,2817,630],{"class":765},[615,2819,769],{"class":629},[615,2821,1007],{"class":625},[615,2823,2785],{"class":804},[615,2825,928],{"class":625},[615,2827,639],{"class":625},[615,2829,2354],{"class":642},[615,2831,807],{"class":625},[615,2833,815],{"class":625},[615,2835,2836],{"class":804}," distinctId",[615,2838,928],{"class":625},[615,2840,639],{"class":625},[615,2842,2843],{"class":642},"checkout-worker",[615,2845,807],{"class":625},[615,2847,633],{"class":625},[615,2849,829],{"class":629},[1836,2851,2852],{"color":1838,"icon":1839},"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,2854,2856],{"id":2855},"when-to-use-a-log-and-when-to-use-an-event","When to use a log and when to use an event",[1335,2858,2859,2873],{},[1338,2860,2861],{},[1341,2862,2863,2865,2869],{},[1344,2864],{},[1344,2866,2867],{},[612,2868,1310],{},[1344,2870,2871],{},[612,2872,2428],{},[1351,2874,2875,2893,2906,2919],{},[1341,2876,2877,2881,2887],{},[1356,2878,2879],{},[669,2880,1748],{},[1356,2882,2883,2884,685],{},"OTLP Logs (",[612,2885,2886],{},"\u002Fi\u002Fv1\u002Flogs",[1356,2888,2889,2890,685],{},"PostHog Events (",[612,2891,2892],{},"\u002Fbatch\u002F",[1341,2894,2895,2900,2903],{},[1356,2896,2897],{},[669,2898,2899],{},"PostHog UI",[1356,2901,2902],{},"Logs viewer",[1356,2904,2905],{},"Events explorer",[1341,2907,2908,2913,2916],{},[1356,2909,2910],{},[669,2911,2912],{},"Cost",[1356,2914,2915],{},"Lower (dedicated logs pipeline)",[1356,2917,2918],{},"Higher (counts as events)",[1341,2920,2921,2926,2929],{},[1356,2922,2923],{},[669,2924,2925],{},"Best for",[1356,2927,2928],{},"Debugging, log search, observability",[1356,2930,2931],{},"Product analytics, cohorts, funnels",[536,2933,2934],{},"You can use both drains simultaneously to get the best of both worlds:",[604,2936,2938],{"className":606,"code":2937,"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,2939,2940,2958,2962,2976,3005,3009,3031,3069],{"__ignoreMap":610},[615,2941,2942,2944,2946,2948,2950,2952,2954,2956],{"class":617,"line":618},[615,2943,622],{"class":621},[615,2945,626],{"class":625},[615,2947,630],{"class":629},[615,2949,633],{"class":625},[615,2951,636],{"class":621},[615,2953,639],{"class":625},[615,2955,643],{"class":642},[615,2957,646],{"class":625},[615,2959,2960],{"class":617,"line":730},[615,2961,753],{"emptyLinePlaceholder":752},[615,2963,2964,2966,2969,2971,2973],{"class":617,"line":749},[615,2965,1484],{"class":780},[615,2967,2968],{"class":629}," logs ",[615,2970,705],{"class":625},[615,2972,630],{"class":765},[615,2974,2975],{"class":629},"()\n",[615,2977,2978,2980,2983,2985,2987,2989,2991,2993,2995,2997,2999,3001,3003],{"class":617,"line":756},[615,2979,1484],{"class":780},[615,2981,2982],{"class":629}," events ",[615,2984,705],{"class":625},[615,2986,630],{"class":765},[615,2988,769],{"class":629},[615,2990,1007],{"class":625},[615,2992,2785],{"class":804},[615,2994,928],{"class":625},[615,2996,639],{"class":625},[615,2998,2354],{"class":642},[615,3000,807],{"class":625},[615,3002,633],{"class":625},[615,3004,829],{"class":629},[615,3006,3007],{"class":617,"line":787},[615,3008,753],{"emptyLinePlaceholder":752},[615,3010,3011,3013,3015,3017,3020,3022,3025,3027,3029],{"class":617,"line":823},[615,3012,1484],{"class":780},[615,3014,1487],{"class":629},[615,3016,705],{"class":625},[615,3018,3019],{"class":780}," async",[615,3021,1326],{"class":625},[615,3023,3024],{"class":774},"ctx",[615,3026,685],{"class":625},[615,3028,781],{"class":780},[615,3030,784],{"class":625},[615,3032,3033,3036,3040,3042,3045,3048,3051,3053,3055,3057,3059,3062,3064,3066],{"class":617,"line":941},[615,3034,3035],{"class":621},"  await",[615,3037,3039],{"class":3038},"sBMFI"," Promise",[615,3041,793],{"class":625},[615,3043,3044],{"class":765},"allSettled",[615,3046,3047],{"class":804},"([",[615,3049,3050],{"class":765},"logs",[615,3052,769],{"class":804},[615,3054,3024],{"class":629},[615,3056,685],{"class":804},[615,3058,815],{"class":625},[615,3060,3061],{"class":765}," events",[615,3063,769],{"class":804},[615,3065,3024],{"class":629},[615,3067,3068],{"class":804},")])\n",[615,3070,3071],{"class":617,"line":956},[615,3072,3073],{"class":625},"}\n",[597,3075,3077],{"id":3076},"troubleshooting","Troubleshooting",[651,3079,3081],{"id":3080},"missing-apikey-error","Missing apiKey error",[604,3083,3089],{"className":3084,"code":3086,"filename":3087,"language":3088,"meta":610},[3085],"language-text","[evlog\u002Fposthog] Missing apiKey. Set POSTHOG_API_KEY env var or pass to createPostHogDrain()\n","Console","text",[612,3090,3086],{"__ignoreMap":610},[536,3092,3093],{},"Make sure your environment variable is set and the server was restarted after adding it.",[651,3095,3097],{"id":3096},"events-not-appearing","Events not appearing",[536,3099,3100],{},"PostHog processes events asynchronously. There may be a short delay (typically under 1 minute) before events appear in the dashboard.",[560,3102,3103,3110,3115],{},[563,3104,3105,3106,3109],{},"Check the server console for ",[612,3107,3108],{},"[evlog\u002Fposthog]"," error messages",[563,3111,3112,3113],{},"Verify your API key is correct and starts with ",[612,3114,684],{},[563,3116,3117,3118,3120],{},"Confirm your ",[612,3119,1578],{}," matches your PostHog region (US vs EU)",[651,3122,3124],{"id":3123},"wrong-region","Wrong region",[536,3126,3127,3128,3130],{},"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,3129,3108],{},") to your server console. Set the correct host:",[604,3132,3134],{"className":692,"code":3133,"filename":694,"language":695,"meta":610,"style":610},"POSTHOG_HOST=https:\u002F\u002Feu.i.posthog.com\n",[612,3135,3136],{"__ignoreMap":610},[615,3137,3138,3140,3142],{"class":617,"line":618},[615,3139,1371],{"class":629},[615,3141,705],{"class":625},[615,3143,2265],{"class":642},[597,3145,3147],{"id":3146},"call-the-drain-without-a-framework","Call the drain without a framework",[536,3149,3150],{},"For advanced use cases, you can use the lower-level functions:",[604,3152,3155],{"className":606,"code":3153,"filename":3154,"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,3156,3157,3181,3185,3190,3203,3219,3225,3229,3234,3248,3263],{"__ignoreMap":610},[615,3158,3159,3161,3163,3166,3168,3171,3173,3175,3177,3179],{"class":617,"line":618},[615,3160,622],{"class":621},[615,3162,626],{"class":625},[615,3164,3165],{"class":629}," sendToPostHog",[615,3167,815],{"class":625},[615,3169,3170],{"class":629}," sendBatchToPostHog",[615,3172,633],{"class":625},[615,3174,636],{"class":621},[615,3176,639],{"class":625},[615,3178,643],{"class":642},[615,3180,646],{"class":625},[615,3182,3183],{"class":617,"line":730},[615,3184,753],{"emptyLinePlaceholder":752},[615,3186,3187],{"class":617,"line":749},[615,3188,3189],{"class":726},"\u002F\u002F Send a single event to PostHog Logs (OTLP)\n",[615,3191,3192,3194,3196,3199,3201],{"class":617,"line":756},[615,3193,1108],{"class":621},[615,3195,3165],{"class":765},[615,3197,3198],{"class":629},"(event",[615,3200,815],{"class":625},[615,3202,784],{"class":625},[615,3204,3205,3208,3210,3212,3215,3217],{"class":617,"line":787},[615,3206,3207],{"class":804},"  apiKey",[615,3209,928],{"class":625},[615,3211,639],{"class":625},[615,3213,3214],{"class":642},"phc_xxx",[615,3216,807],{"class":625},[615,3218,938],{"class":625},[615,3220,3221,3223],{"class":617,"line":823},[615,3222,826],{"class":625},[615,3224,829],{"class":629},[615,3226,3227],{"class":617,"line":941},[615,3228,753],{"emptyLinePlaceholder":752},[615,3230,3231],{"class":617,"line":956},[615,3232,3233],{"class":726},"\u002F\u002F Send multiple events in one request\n",[615,3235,3237,3239,3241,3244,3246],{"class":617,"line":3236},9,[615,3238,1108],{"class":621},[615,3240,3170],{"class":765},[615,3242,3243],{"class":629},"(events",[615,3245,815],{"class":625},[615,3247,784],{"class":625},[615,3249,3251,3253,3255,3257,3259,3261],{"class":617,"line":3250},10,[615,3252,3207],{"class":804},[615,3254,928],{"class":625},[615,3256,639],{"class":625},[615,3258,3214],{"class":642},[615,3260,807],{"class":625},[615,3262,938],{"class":625},[615,3264,3266,3268],{"class":617,"line":3265},11,[615,3267,826],{"class":625},[615,3269,829],{"class":629},[536,3271,3272],{},"For custom events, use the events-specific functions:",[604,3274,3276],{"className":606,"code":3275,"filename":3154,"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,3277,3278,3307,3311,3316,3328,3342,3348,3352,3357,3369,3383,3389,3394,3400],{"__ignoreMap":610},[615,3279,3280,3282,3284,3287,3289,3292,3294,3297,3299,3301,3303,3305],{"class":617,"line":618},[615,3281,622],{"class":621},[615,3283,626],{"class":625},[615,3285,3286],{"class":629}," sendToPostHogEvents",[615,3288,815],{"class":625},[615,3290,3291],{"class":629}," sendBatchToPostHogEvents",[615,3293,815],{"class":625},[615,3295,3296],{"class":629}," toPostHogEvent",[615,3298,633],{"class":625},[615,3300,636],{"class":621},[615,3302,639],{"class":625},[615,3304,643],{"class":642},[615,3306,646],{"class":625},[615,3308,3309],{"class":617,"line":730},[615,3310,753],{"emptyLinePlaceholder":752},[615,3312,3313],{"class":617,"line":749},[615,3314,3315],{"class":726},"\u002F\u002F Send a single custom event\n",[615,3317,3318,3320,3322,3324,3326],{"class":617,"line":756},[615,3319,1108],{"class":621},[615,3321,3286],{"class":765},[615,3323,3198],{"class":629},[615,3325,815],{"class":625},[615,3327,784],{"class":625},[615,3329,3330,3332,3334,3336,3338,3340],{"class":617,"line":787},[615,3331,3207],{"class":804},[615,3333,928],{"class":625},[615,3335,639],{"class":625},[615,3337,3214],{"class":642},[615,3339,807],{"class":625},[615,3341,938],{"class":625},[615,3343,3344,3346],{"class":617,"line":823},[615,3345,826],{"class":625},[615,3347,829],{"class":629},[615,3349,3350],{"class":617,"line":941},[615,3351,753],{"emptyLinePlaceholder":752},[615,3353,3354],{"class":617,"line":956},[615,3355,3356],{"class":726},"\u002F\u002F Send multiple custom events in one request\n",[615,3358,3359,3361,3363,3365,3367],{"class":617,"line":3236},[615,3360,1108],{"class":621},[615,3362,3291],{"class":765},[615,3364,3243],{"class":629},[615,3366,815],{"class":625},[615,3368,784],{"class":625},[615,3370,3371,3373,3375,3377,3379,3381],{"class":617,"line":3250},[615,3372,3207],{"class":804},[615,3374,928],{"class":625},[615,3376,639],{"class":625},[615,3378,3214],{"class":642},[615,3380,807],{"class":625},[615,3382,938],{"class":625},[615,3384,3385,3387],{"class":617,"line":3265},[615,3386,826],{"class":625},[615,3388,829],{"class":629},[615,3390,3392],{"class":617,"line":3391},12,[615,3393,753],{"emptyLinePlaceholder":752},[615,3395,3397],{"class":617,"line":3396},13,[615,3398,3399],{"class":726},"\u002F\u002F Convert event to PostHog format (for inspection)\n",[615,3401,3403,3405,3408,3410,3412,3414,3416,3418,3421,3423,3425,3427,3429,3431],{"class":617,"line":3402},14,[615,3404,1484],{"class":780},[615,3406,3407],{"class":629}," posthogEvent ",[615,3409,705],{"class":625},[615,3411,3296],{"class":765},[615,3413,3198],{"class":629},[615,3415,815],{"class":625},[615,3417,626],{"class":625},[615,3419,3420],{"class":804}," apiKey",[615,3422,928],{"class":625},[615,3424,639],{"class":625},[615,3426,3214],{"class":642},[615,3428,807],{"class":625},[615,3430,633],{"class":625},[615,3432,829],{"class":629},[597,3434,3436],{"id":3435},"next-steps","Next Steps",[1723,3438,3439,3445,3451,3457],{},[563,3440,3441,3444],{},[539,3442,3443],{"href":148},"Axiom Adapter"," - Send logs to Axiom",[563,3446,3447,3450],{},[539,3448,3449],{"href":188},"OTLP Adapter"," - Send logs via OpenTelemetry Protocol",[563,3452,3453,3456],{},[539,3454,3455],{"href":488},"Custom Adapters"," - Build your own adapter",[563,3458,3459,3461],{},[539,3460,513],{"href":514}," - Security and production tips",[3463,3464,3465],"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":3467},[3468,3469,3474,3480,3481,3482,3485,3486,3487,3494,3499,3500],{"id":599,"depth":730,"text":19},{"id":649,"depth":730,"text":24,"children":3470},[3471,3472,3473],{"id":653,"depth":749,"text":654},{"id":688,"depth":749,"text":689},{"id":711,"depth":749,"text":712},{"id":1296,"depth":730,"text":500,"children":3475},[3476,3477,3478,3479],{"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":1848,"depth":730,"text":1849,"children":3483},[3484],{"id":2062,"depth":749,"text":2063},{"id":2190,"depth":730,"text":2191},{"id":2268,"depth":730,"text":2269},{"id":2291,"depth":730,"text":2292,"children":3488},[3489,3490,3491,3492,3493],{"id":2432,"depth":749,"text":2433},{"id":2578,"depth":749,"text":2579},{"id":2700,"depth":749,"text":2701},{"id":2740,"depth":749,"text":2741},{"id":2855,"depth":749,"text":2856},{"id":3076,"depth":730,"text":3077,"children":3495},[3496,3497,3498],{"id":3080,"depth":749,"text":3081},{"id":3096,"depth":749,"text":3097},{"id":3123,"depth":749,"text":3124},{"id":3146,"depth":730,"text":3147},{"id":3435,"depth":730,"text":3436},"Send wide events to PostHog Logs via OTLP for structured log querying, debugging, and observability in your PostHog dashboard.","md",[3504,3510],{"label":3505,"icon":3506,"to":662,"target":3507,"color":3508,"variant":3509},"PostHog Dashboard","i-lucide-external-link","_blank","neutral","subtle",{"label":3443,"icon":150,"to":148,"color":3508,"variant":3509},{},{"title":152,"icon":155},{"title":531,"description":3501},"dwA78B71tyAF3ABrLw2YMKZSaqrdfXA5nrYwLNdeDnQ",[3516,3518],{"title":147,"path":148,"stem":149,"description":3517,"icon":150,"children":-1},"Send wide events to Axiom for powerful querying, dashboards, and alerting. Zero-config setup with environment variables and automatic batching.",{"title":157,"path":158,"stem":159,"description":3519,"icon":160,"children":-1},"Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables.",1786800766922]