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