[{"data":1,"prerenderedAt":1376},["ShallowReactive",2],{"navigation_docs":3,"-build-on-top-fanout-and-multi-drain":454,"-build-on-top-fanout-and-multi-drain-surround":1371},[4,35,159,201,289,352,438],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,99,127],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,297,302,307,312,316,321,326,330,334,338,342,347],{"title":41,"path":295,"stem":296,"icon":54},"\u002Fbuild-on-top\u002Foverview","5.build-on-top\u002F0.overview",{"title":298,"path":299,"stem":300,"icon":301},"In-process stream","\u002Fbuild-on-top\u002Fin-process-stream","5.build-on-top\u002F1.in-process-stream","i-lucide-radio-tower",{"title":303,"path":304,"stem":305,"icon":306},"Fanout","\u002Fbuild-on-top\u002Ffanout-and-multi-drain","5.build-on-top\u002F10.fanout-and-multi-drain","i-lucide-share-2",{"title":308,"path":309,"stem":310,"icon":311},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F11.identity-headers","i-lucide-fingerprint",{"title":313,"path":314,"stem":315,"icon":288},"Custom framework","\u002Fbuild-on-top\u002Fcustom-framework","5.build-on-top\u002F12.custom-framework",{"title":317,"path":318,"stem":319,"icon":320},"Stream server","\u002Fbuild-on-top\u002Fstream-server","5.build-on-top\u002F2.stream-server","i-lucide-radio",{"title":322,"path":323,"stem":324,"icon":325},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F3.fs-reader","i-lucide-folder-search",{"title":156,"path":327,"stem":328,"icon":329},"\u002Fbuild-on-top\u002Fconsumer-recipes","5.build-on-top\u002F4.consumer-recipes","i-lucide-chef-hat",{"title":331,"path":332,"stem":333,"icon":288},"Plugins","\u002Fbuild-on-top\u002Fplugins","5.build-on-top\u002F5.plugins",{"title":335,"path":336,"stem":337,"icon":28},"Custom enrichers","\u002Fbuild-on-top\u002Fcustom-enrichers","5.build-on-top\u002F6.custom-enrichers",{"title":339,"path":340,"stem":341,"icon":178},"Tail sampling","\u002Fbuild-on-top\u002Ftail-sampling","5.build-on-top\u002F7.tail-sampling",{"title":343,"path":344,"stem":345,"icon":346},"Custom drains","\u002Fbuild-on-top\u002Fcustom-drains","5.build-on-top\u002F8.custom-drains","i-lucide-code-2",{"title":348,"path":349,"stem":350,"icon":351},"Drain pipeline","\u002Fbuild-on-top\u002Fdrain-pipeline","5.build-on-top\u002F9.drain-pipeline","i-lucide-workflow",{"title":353,"path":354,"stem":355,"children":356,"page":34},"Adapters","\u002Fadapters","6.adapters",[357,360,400,415],{"title":41,"path":358,"stem":359,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":361,"path":362,"stem":363,"children":364,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[365,370,375,380,385,390,395],{"title":366,"path":367,"stem":368,"icon":369},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":371,"path":372,"stem":373,"icon":374},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":376,"path":377,"stem":378,"icon":379},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":381,"path":382,"stem":383,"icon":384},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":386,"path":387,"stem":388,"icon":389},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":391,"path":392,"stem":393,"icon":394},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":396,"path":397,"stem":398,"icon":399},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":401,"path":402,"stem":403,"children":404,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[405,410],{"title":406,"path":407,"stem":408,"icon":409},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":411,"path":412,"stem":413,"icon":414},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":416,"path":417,"stem":418,"children":419,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[420,424,429,433],{"title":421,"path":422,"stem":423,"icon":351},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline",{"title":425,"path":426,"stem":427,"icon":428},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":430,"path":431,"stem":432,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":434,"path":435,"stem":436,"icon":437},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":439,"path":440,"stem":441,"children":442,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[443,446,450],{"title":41,"path":444,"stem":445,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":447,"path":448,"stem":449,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":451,"path":452,"stem":453,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":455,"title":456,"body":457,"description":1364,"extension":1365,"links":1366,"meta":1367,"navigation":1368,"path":304,"seo":1369,"stem":305,"__hash__":1370},"docs\u002F5.build-on-top\u002F10.fanout-and-multi-drain.md","Fanout and multi-drain",{"type":458,"value":459,"toc":1357},"minimark",[460,469,472,552,557,946,961,965,985,989,992,1295,1301,1305,1333,1337,1353],[461,462,463,464,468],"p",{},"In production, the same wide event often needs to reach more than one destination: a long-term store (Axiom), a metrics tool (Datadog), an error tracker (Sentry), and a local fs drain for incident replay. evlog's drain pipeline accepts ",[465,466,467],"strong",{},"multiple drains"," in one composition — the same batch is fanned out to all of them in parallel.",[470,471],"drain-fan-out",{},[473,474,477,480,543],"prompt",{":actions":475,"description":476,"icon":306},"[\"copy\",\"cursor\",\"windsurf\"]","Fan out evlog events to multiple destinations",[461,478,479],{},"Send each wide event to several destinations in parallel through a single drain pipeline.",[481,482,483,500,511,514,532],"ul",{},[484,485,486,487,491,492,495,496,499],"li",{},"Use one ",[488,489,490],"code",{},"createDrainPipeline"," from ",[488,493,494],{},"evlog\u002Fpipeline"," and pass all drains as positional args: ",[488,497,498],{},"pipeline(drainA, drainB, drainC)"," — cheaper than nesting pipelines",[484,501,502,503,506,507,510],{},"Pick destinations by purpose: long-term store (Axiom \u002F Better Stack \u002F Datadog), error tracker (Sentry — typically ",[488,504,505],{},"{ minLevel: 'error' }"," so it doesn't get all events), local replay (",[488,508,509],{},"createFsDrain",")",[484,512,513],{},"Each drain runs independently — a slow or failing destination doesn't block the others; pipeline retries are per-drain",[484,515,516,517,520,521,520,524,527,528,531],{},"Tune ",[488,518,519],{},"batch.size",", ",[488,522,523],{},"batch.intervalMs",[488,525,526],{},"retry.maxAttempts",", and ",[488,529,530],{},"bufferSize"," once at the pipeline level — applies to all fanned drains",[484,533,534,535,538,539,542],{},"For destinations that need different filtering, prefer per-drain ",[488,536,537],{},"minLevel"," \u002F ",[488,540,541],{},"filter"," options over multiple pipelines",[461,544,545,546],{},"Docs: ",[547,548,549],"a",{"href":549,"rel":550},"https:\u002F\u002Fwww.evlog.dev\u002Fbuild-on-top\u002Ffanout-and-multi-drain",[551],"nofollow",[553,554,556],"h2",{"id":555},"the-recipe","The recipe",[558,559,564],"pre",{"className":560,"code":561,"language":562,"meta":563,"style":563},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createDatadogDrain } from 'evlog\u002Fdatadog'\nimport { createSentryDrain } from 'evlog\u002Fsentry'\nimport { createFsDrain } from 'evlog\u002Ffs'\nimport type { DrainContext } from 'evlog'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>({\n  batch: { size: 50, intervalMs: 2000 },\n  retry: { maxAttempts: 3 },\n  bufferSize: 1000,\n})\n\nexport const drain = pipeline(\n  createAxiomDrain(),\n  createDatadogDrain(),\n  createSentryDrain({ minLevel: 'error' }),  \u002F\u002F Sentry only gets errors\n  createFsDrain({ dir: '.evlog\u002Flogs', maxFiles: 14 }),\n)\n","ts","",[488,565,566,598,619,640,661,682,706,713,745,780,800,814,823,828,848,859,869,903,941],{"__ignoreMap":563},[567,568,571,575,579,583,586,589,592,595],"span",{"class":569,"line":570},"line",1,[567,572,574],{"class":573},"s7zQu","import",[567,576,578],{"class":577},"sMK4o"," {",[567,580,582],{"class":581},"sTEyZ"," createDrainPipeline",[567,584,585],{"class":577}," }",[567,587,588],{"class":573}," from",[567,590,591],{"class":577}," '",[567,593,494],{"class":594},"sfazB",[567,596,597],{"class":577},"'\n",[567,599,601,603,605,608,610,612,614,617],{"class":569,"line":600},2,[567,602,574],{"class":573},[567,604,578],{"class":577},[567,606,607],{"class":581}," createAxiomDrain",[567,609,585],{"class":577},[567,611,588],{"class":573},[567,613,591],{"class":577},[567,615,616],{"class":594},"evlog\u002Faxiom",[567,618,597],{"class":577},[567,620,622,624,626,629,631,633,635,638],{"class":569,"line":621},3,[567,623,574],{"class":573},[567,625,578],{"class":577},[567,627,628],{"class":581}," createDatadogDrain",[567,630,585],{"class":577},[567,632,588],{"class":573},[567,634,591],{"class":577},[567,636,637],{"class":594},"evlog\u002Fdatadog",[567,639,597],{"class":577},[567,641,643,645,647,650,652,654,656,659],{"class":569,"line":642},4,[567,644,574],{"class":573},[567,646,578],{"class":577},[567,648,649],{"class":581}," createSentryDrain",[567,651,585],{"class":577},[567,653,588],{"class":573},[567,655,591],{"class":577},[567,657,658],{"class":594},"evlog\u002Fsentry",[567,660,597],{"class":577},[567,662,664,666,668,671,673,675,677,680],{"class":569,"line":663},5,[567,665,574],{"class":573},[567,667,578],{"class":577},[567,669,670],{"class":581}," createFsDrain",[567,672,585],{"class":577},[567,674,588],{"class":573},[567,676,591],{"class":577},[567,678,679],{"class":594},"evlog\u002Ffs",[567,681,597],{"class":577},[567,683,685,687,690,692,695,697,699,701,704],{"class":569,"line":684},6,[567,686,574],{"class":573},[567,688,689],{"class":573}," type",[567,691,578],{"class":577},[567,693,694],{"class":581}," DrainContext",[567,696,585],{"class":577},[567,698,588],{"class":573},[567,700,591],{"class":577},[567,702,703],{"class":594},"evlog",[567,705,597],{"class":577},[567,707,709],{"class":569,"line":708},7,[567,710,712],{"emptyLinePlaceholder":711},true,"\n",[567,714,716,720,723,726,729,732,736,739,742],{"class":569,"line":715},8,[567,717,719],{"class":718},"spNyl","const",[567,721,722],{"class":581}," pipeline ",[567,724,725],{"class":577},"=",[567,727,582],{"class":728},"s2Zo4",[567,730,731],{"class":577},"\u003C",[567,733,735],{"class":734},"sBMFI","DrainContext",[567,737,738],{"class":577},">",[567,740,741],{"class":581},"(",[567,743,744],{"class":577},"{\n",[567,746,748,752,755,757,760,762,766,769,772,774,777],{"class":569,"line":747},9,[567,749,751],{"class":750},"swJcz","  batch",[567,753,754],{"class":577},":",[567,756,578],{"class":577},[567,758,759],{"class":750}," size",[567,761,754],{"class":577},[567,763,765],{"class":764},"sbssI"," 50",[567,767,768],{"class":577},",",[567,770,771],{"class":750}," intervalMs",[567,773,754],{"class":577},[567,775,776],{"class":764}," 2000",[567,778,779],{"class":577}," },\n",[567,781,783,786,788,790,793,795,798],{"class":569,"line":782},10,[567,784,785],{"class":750},"  retry",[567,787,754],{"class":577},[567,789,578],{"class":577},[567,791,792],{"class":750}," maxAttempts",[567,794,754],{"class":577},[567,796,797],{"class":764}," 3",[567,799,779],{"class":577},[567,801,803,806,808,811],{"class":569,"line":802},11,[567,804,805],{"class":750},"  bufferSize",[567,807,754],{"class":577},[567,809,810],{"class":764}," 1000",[567,812,813],{"class":577},",\n",[567,815,817,820],{"class":569,"line":816},12,[567,818,819],{"class":577},"}",[567,821,822],{"class":581},")\n",[567,824,826],{"class":569,"line":825},13,[567,827,712],{"emptyLinePlaceholder":711},[567,829,831,834,837,840,842,845],{"class":569,"line":830},14,[567,832,833],{"class":573},"export",[567,835,836],{"class":718}," const",[567,838,839],{"class":581}," drain ",[567,841,725],{"class":577},[567,843,844],{"class":728}," pipeline",[567,846,847],{"class":581},"(\n",[567,849,851,854,857],{"class":569,"line":850},15,[567,852,853],{"class":728},"  createAxiomDrain",[567,855,856],{"class":581},"()",[567,858,813],{"class":577},[567,860,862,865,867],{"class":569,"line":861},16,[567,863,864],{"class":728},"  createDatadogDrain",[567,866,856],{"class":581},[567,868,813],{"class":577},[567,870,872,875,877,880,883,885,887,890,893,895,897,899],{"class":569,"line":871},17,[567,873,874],{"class":728},"  createSentryDrain",[567,876,741],{"class":581},[567,878,879],{"class":577},"{",[567,881,882],{"class":750}," minLevel",[567,884,754],{"class":577},[567,886,591],{"class":577},[567,888,889],{"class":594},"error",[567,891,892],{"class":577},"'",[567,894,585],{"class":577},[567,896,510],{"class":581},[567,898,768],{"class":577},[567,900,902],{"class":901},"sHwdD","  \u002F\u002F Sentry only gets errors\n",[567,904,906,909,911,913,916,918,920,923,925,927,930,932,935,937,939],{"class":569,"line":905},18,[567,907,908],{"class":728},"  createFsDrain",[567,910,741],{"class":581},[567,912,879],{"class":577},[567,914,915],{"class":750}," dir",[567,917,754],{"class":577},[567,919,591],{"class":577},[567,921,922],{"class":594},".evlog\u002Flogs",[567,924,892],{"class":577},[567,926,768],{"class":577},[567,928,929],{"class":750}," maxFiles",[567,931,754],{"class":577},[567,933,934],{"class":764}," 14",[567,936,585],{"class":577},[567,938,510],{"class":581},[567,940,813],{"class":577},[567,942,944],{"class":569,"line":943},19,[567,945,822],{"class":581},[461,947,948,949,952,953,956,957,960],{},"Then register ",[488,950,951],{},"drain"," wherever your framework integration takes a drain — ",[488,954,955],{},"nitroApp.hooks.hook('evlog:drain', drain)"," for Nitro, ",[488,958,959],{},"initLogger({ drain })"," for Next.js \u002F standalone, etc.",[553,962,964],{"id":963},"what-you-get","What you get",[481,966,967,973,979],{},[484,968,969,972],{},[465,970,971],{},"Parallel dispatch"," — every batch hits all four destinations concurrently",[484,974,975,978],{},[465,976,977],{},"Independent failures"," — if Datadog's API is down, Axiom and Sentry still receive events; the failed batch is retried for Datadog only",[484,980,981,984],{},[465,982,983],{},"Shared backpressure"," — the buffer is sized once for the whole pipeline; if any drain falls behind, the oldest events drop together (consistent across destinations)",[553,986,988],{"id":987},"per-drain-filtering","Per-drain filtering",[461,990,991],{},"Wrap a drain to filter events before they reach it:",[558,993,995],{"className":560,"code":994,"language":562,"meta":563,"style":563},"function onlyErrors(inner: typeof createSentryDrain): typeof createSentryDrain {\n  return (opts) => {\n    const wrapped = inner(opts)\n    return async (ctx) => {\n      const filtered = (Array.isArray(ctx) ? ctx : [ctx]).filter(c => c.event?.level === 'error')\n      if (filtered.length > 0) await wrapped(filtered as never)\n    }\n  }\n}\n\nexport const drain = pipeline(\n  createAxiomDrain(),                                     \u002F\u002F all events\n  onlyErrors(createSentryDrain)({ dsn: process.env.SENTRY_DSN! }),  \u002F\u002F errors only\n)\n",[488,996,997,1028,1047,1067,1086,1167,1207,1212,1217,1222,1226,1240,1251,1291],{"__ignoreMap":563},[567,998,999,1002,1005,1007,1011,1013,1016,1018,1021,1023,1026],{"class":569,"line":570},[567,1000,1001],{"class":718},"function",[567,1003,1004],{"class":728}," onlyErrors",[567,1006,741],{"class":577},[567,1008,1010],{"class":1009},"sHdIc","inner",[567,1012,754],{"class":577},[567,1014,1015],{"class":577}," typeof",[567,1017,649],{"class":581},[567,1019,1020],{"class":577},"):",[567,1022,1015],{"class":577},[567,1024,1025],{"class":581}," createSentryDrain ",[567,1027,744],{"class":577},[567,1029,1030,1033,1036,1039,1041,1044],{"class":569,"line":600},[567,1031,1032],{"class":573},"  return",[567,1034,1035],{"class":577}," (",[567,1037,1038],{"class":1009},"opts",[567,1040,510],{"class":577},[567,1042,1043],{"class":718}," =>",[567,1045,1046],{"class":577}," {\n",[567,1048,1049,1052,1055,1058,1061,1063,1065],{"class":569,"line":621},[567,1050,1051],{"class":718},"    const",[567,1053,1054],{"class":581}," wrapped",[567,1056,1057],{"class":577}," =",[567,1059,1060],{"class":728}," inner",[567,1062,741],{"class":750},[567,1064,1038],{"class":581},[567,1066,822],{"class":750},[567,1068,1069,1072,1075,1077,1080,1082,1084],{"class":569,"line":642},[567,1070,1071],{"class":573},"    return",[567,1073,1074],{"class":718}," async",[567,1076,1035],{"class":577},[567,1078,1079],{"class":1009},"ctx",[567,1081,510],{"class":577},[567,1083,1043],{"class":718},[567,1085,1046],{"class":577},[567,1087,1088,1091,1094,1096,1098,1101,1104,1107,1109,1111,1114,1117,1120,1123,1126,1128,1131,1133,1135,1137,1140,1142,1145,1147,1150,1153,1156,1159,1161,1163,1165],{"class":569,"line":663},[567,1089,1090],{"class":718},"      const",[567,1092,1093],{"class":581}," filtered",[567,1095,1057],{"class":577},[567,1097,1035],{"class":750},[567,1099,1100],{"class":581},"Array",[567,1102,1103],{"class":577},".",[567,1105,1106],{"class":728},"isArray",[567,1108,741],{"class":750},[567,1110,1079],{"class":581},[567,1112,1113],{"class":750},") ",[567,1115,1116],{"class":577},"?",[567,1118,1119],{"class":581}," ctx",[567,1121,1122],{"class":577}," :",[567,1124,1125],{"class":750}," [",[567,1127,1079],{"class":581},[567,1129,1130],{"class":750},"])",[567,1132,1103],{"class":577},[567,1134,541],{"class":728},[567,1136,741],{"class":750},[567,1138,1139],{"class":1009},"c",[567,1141,1043],{"class":718},[567,1143,1144],{"class":581}," c",[567,1146,1103],{"class":577},[567,1148,1149],{"class":581},"event",[567,1151,1152],{"class":577},"?.",[567,1154,1155],{"class":581},"level",[567,1157,1158],{"class":577}," ===",[567,1160,591],{"class":577},[567,1162,889],{"class":594},[567,1164,892],{"class":577},[567,1166,822],{"class":750},[567,1168,1169,1172,1174,1177,1179,1182,1185,1188,1190,1193,1195,1197,1199,1202,1205],{"class":569,"line":684},[567,1170,1171],{"class":573},"      if",[567,1173,1035],{"class":750},[567,1175,1176],{"class":581},"filtered",[567,1178,1103],{"class":577},[567,1180,1181],{"class":581},"length",[567,1183,1184],{"class":577}," >",[567,1186,1187],{"class":764}," 0",[567,1189,1113],{"class":750},[567,1191,1192],{"class":573},"await",[567,1194,1054],{"class":728},[567,1196,741],{"class":750},[567,1198,1176],{"class":581},[567,1200,1201],{"class":573}," as",[567,1203,1204],{"class":734}," never",[567,1206,822],{"class":750},[567,1208,1209],{"class":569,"line":708},[567,1210,1211],{"class":577},"    }\n",[567,1213,1214],{"class":569,"line":715},[567,1215,1216],{"class":577},"  }\n",[567,1218,1219],{"class":569,"line":747},[567,1220,1221],{"class":577},"}\n",[567,1223,1224],{"class":569,"line":782},[567,1225,712],{"emptyLinePlaceholder":711},[567,1227,1228,1230,1232,1234,1236,1238],{"class":569,"line":802},[567,1229,833],{"class":573},[567,1231,836],{"class":718},[567,1233,839],{"class":581},[567,1235,725],{"class":577},[567,1237,844],{"class":728},[567,1239,847],{"class":581},[567,1241,1242,1244,1246,1248],{"class":569,"line":816},[567,1243,853],{"class":728},[567,1245,856],{"class":581},[567,1247,768],{"class":577},[567,1249,1250],{"class":901},"                                     \u002F\u002F all events\n",[567,1252,1253,1256,1259,1261,1264,1266,1269,1271,1274,1276,1279,1282,1284,1286,1288],{"class":569,"line":825},[567,1254,1255],{"class":728},"  onlyErrors",[567,1257,1258],{"class":581},"(createSentryDrain)(",[567,1260,879],{"class":577},[567,1262,1263],{"class":750}," dsn",[567,1265,754],{"class":577},[567,1267,1268],{"class":581}," process",[567,1270,1103],{"class":577},[567,1272,1273],{"class":581},"env",[567,1275,1103],{"class":577},[567,1277,1278],{"class":581},"SENTRY_DSN",[567,1280,1281],{"class":577},"!",[567,1283,585],{"class":577},[567,1285,510],{"class":581},[567,1287,768],{"class":577},[567,1289,1290],{"class":901},"  \u002F\u002F errors only\n",[567,1292,1293],{"class":569,"line":830},[567,1294,822],{"class":581},[461,1296,1297,1298,1300],{},"Most built-in drains expose ",[488,1299,537],{}," directly, so you only need this pattern for non-level filters (path, custom field, etc.).",[553,1302,1304],{"id":1303},"what-not-to-do","What not to do",[481,1306,1307,1313,1323],{},[484,1308,1309,1312],{},[465,1310,1311],{},"Don't create one pipeline per drain"," — defeats the batch \u002F retry sharing",[484,1314,1315,1322],{},[465,1316,1317,1318,1321],{},"Don't forget ",[488,1319,1320],{},"drain.flush()"," on shutdown"," — events buffered for fanout are lost on abrupt exit",[484,1324,1325,1328,1329,1332],{},[465,1326,1327],{},"Don't fan out to a serverless-incompatible target without checking"," — the ",[547,1330,1331],{"href":318},"stream server"," reaches every connected client through the in-process stream; it's not a drain",[553,1334,1336],{"id":1335},"going-further","Going further",[481,1338,1339,1348],{},[484,1340,1341,1343,1344,1347],{},[547,1342,348],{"href":349}," — the full reference for ",[488,1345,1346],{},"createDrainPipeline()"," options",[484,1349,1350,1352],{},[547,1351,343],{"href":344}," — fanout works with any drain, including ones you write",[1354,1355,1356],"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 pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .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 .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 .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}",{"title":563,"searchDepth":600,"depth":600,"links":1358},[1359,1360,1361,1362,1363],{"id":555,"depth":600,"text":556},{"id":963,"depth":600,"text":964},{"id":987,"depth":600,"text":988},{"id":1303,"depth":600,"text":1304},{"id":1335,"depth":600,"text":1336},"Send the same wide event to several destinations in parallel — Axiom plus Datadog plus Sentry plus the local fs drain — through a single pipeline.","md",null,{},{"title":303,"icon":306},{"title":456,"description":1364},"snRDWyi633_nmEqlbcDsgG6gnsYSjur98strXORhLq8",[1372,1374],{"title":298,"path":299,"stem":300,"description":1373,"icon":301,"children":-1},"Subscribe to wide events flowing through evlog, in-process, with createStreamDrain — sync listeners, async iterators, and a ring buffer.",{"title":308,"path":309,"stem":310,"description":1375,"icon":311,"children":-1},"Every drain request sent by evlog is tagged with a User-Agent and an X-Evlog-Source header so receivers can identify the traffic.",1778340942693]