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