[{"data":1,"prerenderedAt":1295},["ShallowReactive",2],{"navigation_docs":3,"-logging-audit-pipeline":407,"-logging-audit-pipeline-surround":1290},[4,35,159,201,289,304,391],{"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,299],{"title":295,"path":296,"stem":297,"icon":298},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F1.identity-headers","i-lucide-fingerprint",{"title":300,"path":301,"stem":302,"icon":303},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F4.fs-reader","i-lucide-folder-search",{"title":305,"path":306,"stem":307,"children":308,"page":34},"Adapters","\u002Fadapters","6.adapters",[309,312,352,367],{"title":41,"path":310,"stem":311,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":313,"path":314,"stem":315,"children":316,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[317,322,327,332,337,342,347],{"title":318,"path":319,"stem":320,"icon":321},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":323,"path":324,"stem":325,"icon":326},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":328,"path":329,"stem":330,"icon":331},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":333,"path":334,"stem":335,"icon":336},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":338,"path":339,"stem":340,"icon":341},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":343,"path":344,"stem":345,"icon":346},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":348,"path":349,"stem":350,"icon":351},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":353,"path":354,"stem":355,"children":356,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[357,362],{"title":358,"path":359,"stem":360,"icon":361},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":363,"path":364,"stem":365,"icon":366},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":368,"path":369,"stem":370,"children":371,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[372,377,382,386],{"title":373,"path":374,"stem":375,"icon":376},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":378,"path":379,"stem":380,"icon":381},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":383,"path":384,"stem":385,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":387,"path":388,"stem":389,"icon":390},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":392,"path":393,"stem":394,"children":395,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[396,399,403],{"title":41,"path":397,"stem":398,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":400,"path":401,"stem":402,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":404,"path":405,"stem":406,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":408,"title":409,"body":410,"description":1279,"extension":1280,"links":1281,"meta":1286,"navigation":1287,"path":148,"seo":1288,"stem":149,"__hash__":1289},"docs\u002F2.logging\u002F8.audit\u002F04.pipeline.md","Drains & Integrity",{"type":411,"value":412,"toc":1271},"minimark",[413,430,437,446,533,536,659,677,683,703,717,854,861,913,919,924,930,987,1004,1009,1012,1087,1091,1094,1243,1249,1252,1267],[414,415,416,417,421,422,425,426,429],"p",{},"Three building blocks: ",[418,419,420],"code",{},"auditEnricher"," fills context, ",[418,423,424],{},"auditOnly"," routes audits to a dedicated drain, and ",[418,427,428],{},"signed"," adds tamper-evident integrity. Each is opt-in and replaceable.",[431,432,434],"h2",{"id":433},"auditenricher",[418,435,436],{},"auditEnricher()",[414,438,439,441,442,445],{},[418,440,436],{}," populates ",[418,443,444],{},"event.audit.context.{requestId, traceId, ip, userAgent, tenantId}",". Skip it and ship a custom enricher if your strategy differs.",[447,448,454],"pre",{"className":449,"code":450,"filename":451,"language":452,"meta":453,"style":453},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { auditEnricher } from 'evlog'\n\nnitro.hooks.hook('evlog:enrich', auditEnricher())\n","server\u002Fplugins\u002Fevlog.ts","typescript","",[418,455,456,489,496],{"__ignoreMap":453},[457,458,461,465,469,473,476,479,482,486],"span",{"class":459,"line":460},"line",1,[457,462,464],{"class":463},"s7zQu","import",[457,466,468],{"class":467},"sMK4o"," {",[457,470,472],{"class":471},"sTEyZ"," auditEnricher",[457,474,475],{"class":467}," }",[457,477,478],{"class":463}," from",[457,480,481],{"class":467}," '",[457,483,485],{"class":484},"sfazB","evlog",[457,487,488],{"class":467},"'\n",[457,490,492],{"class":459,"line":491},2,[457,493,495],{"emptyLinePlaceholder":494},true,"\n",[457,497,499,502,505,508,510,514,517,520,523,525,528,530],{"class":459,"line":498},3,[457,500,501],{"class":471},"nitro",[457,503,504],{"class":467},".",[457,506,507],{"class":471},"hooks",[457,509,504],{"class":467},[457,511,513],{"class":512},"s2Zo4","hook",[457,515,516],{"class":471},"(",[457,518,519],{"class":467},"'",[457,521,522],{"class":484},"evlog:enrich",[457,524,519],{"class":467},[457,526,527],{"class":467},",",[457,529,472],{"class":512},[457,531,532],{"class":471},"())\n",[414,534,535],{},"For multi-tenant apps and custom session bridges, pass options:",[447,537,539],{"className":449,"code":538,"language":452,"meta":453,"style":453},"nitro.hooks.hook('evlog:enrich', auditEnricher({\n  tenantId: ctx => ctx.event.tenant as string | undefined,\n  bridge: { getSession: async ctx => readSessionActor(ctx.headers) },\n}))\n",[418,540,541,570,614,650],{"__ignoreMap":453},[457,542,543,545,547,549,551,553,555,557,559,561,563,565,567],{"class":459,"line":460},[457,544,501],{"class":471},[457,546,504],{"class":467},[457,548,507],{"class":471},[457,550,504],{"class":467},[457,552,513],{"class":512},[457,554,516],{"class":471},[457,556,519],{"class":467},[457,558,522],{"class":484},[457,560,519],{"class":467},[457,562,527],{"class":467},[457,564,472],{"class":512},[457,566,516],{"class":471},[457,568,569],{"class":467},"{\n",[457,571,572,575,578,582,586,588,590,593,595,598,601,605,608,611],{"class":459,"line":491},[457,573,574],{"class":512},"  tenantId",[457,576,577],{"class":467},":",[457,579,581],{"class":580},"sHdIc"," ctx",[457,583,585],{"class":584},"spNyl"," =>",[457,587,581],{"class":471},[457,589,504],{"class":467},[457,591,592],{"class":471},"event",[457,594,504],{"class":467},[457,596,597],{"class":471},"tenant ",[457,599,600],{"class":463},"as",[457,602,604],{"class":603},"sBMFI"," string",[457,606,607],{"class":467}," |",[457,609,610],{"class":603}," undefined",[457,612,613],{"class":467},",\n",[457,615,616,620,622,624,627,629,632,634,636,639,642,644,647],{"class":459,"line":498},[457,617,619],{"class":618},"swJcz","  bridge",[457,621,577],{"class":467},[457,623,468],{"class":467},[457,625,626],{"class":512}," getSession",[457,628,577],{"class":467},[457,630,631],{"class":584}," async",[457,633,581],{"class":580},[457,635,585],{"class":584},[457,637,638],{"class":512}," readSessionActor",[457,640,641],{"class":471},"(ctx",[457,643,504],{"class":467},[457,645,646],{"class":471},"headers) ",[457,648,649],{"class":467},"},\n",[457,651,653,656],{"class":459,"line":652},4,[457,654,655],{"class":467},"}",[457,657,658],{"class":471},"))\n",[414,660,661,662,664,665,668,669,672,673,676],{},"Without ",[418,663,420],{},", ",[418,666,667],{},"audit.context"," stays empty — auditors and incident responders need at least ",[418,670,671],{},"requestId"," and ",[418,674,675],{},"ip"," to triangulate a recorded action.",[431,678,680],{"id":679},"auditonly",[418,681,682],{},"auditOnly()",[684,685,686,690,691,694,695,698,699,702],"tip",{},[687,688,689],"strong",{},"Why filter audits to a separate sink?"," Three reasons: ",[687,692,693],{},"cost"," (audit volume is tiny next to product telemetry — keep them separate so retention costs don't explode), ",[687,696,697],{},"permissions"," (the audit dataset should be read-only for engineers and write-only for the app), and ",[687,700,701],{},"retention"," (audits often live 7+ years; product logs rarely live more than 90 days).",[414,704,705,708,709,712,713,716],{},[418,706,707],{},"auditOnly(drain)"," only forwards events with an ",[418,710,711],{},"audit"," field. Compose with ",[687,714,715],{},"any"," drain:",[447,718,720],{"className":449,"code":719,"language":452,"meta":453,"style":453},"import { auditOnly } from 'evlog'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\n\u002F\u002F Send audits to a dedicated Axiom dataset:\nnitro.hooks.hook('evlog:drain', auditOnly(\n  createAxiomDrain({ dataset: 'audit', token: process.env.AXIOM_AUDIT_TOKEN }),\n))\n",[418,721,722,741,761,765,771,800,849],{"__ignoreMap":453},[457,723,724,726,728,731,733,735,737,739],{"class":459,"line":460},[457,725,464],{"class":463},[457,727,468],{"class":467},[457,729,730],{"class":471}," auditOnly",[457,732,475],{"class":467},[457,734,478],{"class":463},[457,736,481],{"class":467},[457,738,485],{"class":484},[457,740,488],{"class":467},[457,742,743,745,747,750,752,754,756,759],{"class":459,"line":491},[457,744,464],{"class":463},[457,746,468],{"class":467},[457,748,749],{"class":471}," createAxiomDrain",[457,751,475],{"class":467},[457,753,478],{"class":463},[457,755,481],{"class":467},[457,757,758],{"class":484},"evlog\u002Faxiom",[457,760,488],{"class":467},[457,762,763],{"class":459,"line":498},[457,764,495],{"emptyLinePlaceholder":494},[457,766,767],{"class":459,"line":652},[457,768,770],{"class":769},"sHwdD","\u002F\u002F Send audits to a dedicated Axiom dataset:\n",[457,772,774,776,778,780,782,784,786,788,791,793,795,797],{"class":459,"line":773},5,[457,775,501],{"class":471},[457,777,504],{"class":467},[457,779,507],{"class":471},[457,781,504],{"class":467},[457,783,513],{"class":512},[457,785,516],{"class":471},[457,787,519],{"class":467},[457,789,790],{"class":484},"evlog:drain",[457,792,519],{"class":467},[457,794,527],{"class":467},[457,796,730],{"class":512},[457,798,799],{"class":471},"(\n",[457,801,803,806,808,811,814,816,818,820,822,824,827,829,832,834,837,839,842,844,847],{"class":459,"line":802},6,[457,804,805],{"class":512},"  createAxiomDrain",[457,807,516],{"class":471},[457,809,810],{"class":467},"{",[457,812,813],{"class":618}," dataset",[457,815,577],{"class":467},[457,817,481],{"class":467},[457,819,711],{"class":484},[457,821,519],{"class":467},[457,823,527],{"class":467},[457,825,826],{"class":618}," token",[457,828,577],{"class":467},[457,830,831],{"class":471}," process",[457,833,504],{"class":467},[457,835,836],{"class":471},"env",[457,838,504],{"class":467},[457,840,841],{"class":471},"AXIOM_AUDIT_TOKEN ",[457,843,655],{"class":467},[457,845,846],{"class":471},")",[457,848,613],{"class":467},[457,850,852],{"class":459,"line":851},7,[457,853,658],{"class":471},[414,855,856,857,860],{},"Set ",[418,858,859],{},"await: true"," to make audit writes synchronous (no fire-and-forget for audits — crash-safe by default):",[447,862,864],{"className":449,"code":863,"language":452,"meta":453,"style":453},"auditOnly(createFsDrain({ dir: '.audit' }), { await: true })\n",[418,865,866],{"__ignoreMap":453},[457,867,868,870,872,875,877,879,882,884,886,889,891,893,895,897,899,902,904,908,910],{"class":459,"line":460},[457,869,424],{"class":512},[457,871,516],{"class":471},[457,873,874],{"class":512},"createFsDrain",[457,876,516],{"class":471},[457,878,810],{"class":467},[457,880,881],{"class":618}," dir",[457,883,577],{"class":467},[457,885,481],{"class":467},[457,887,888],{"class":484},".audit",[457,890,519],{"class":467},[457,892,475],{"class":467},[457,894,846],{"class":471},[457,896,527],{"class":467},[457,898,468],{"class":467},[457,900,901],{"class":618}," await",[457,903,577],{"class":467},[457,905,907],{"class":906},"sfNiH"," true",[457,909,475],{"class":467},[457,911,912],{"class":471},")\n",[414,914,915,916,918],{},"The ",[418,917,859],{}," flag costs you a small bit of latency per request that records an audit (one synchronous drain call), but guarantees the audit hits disk before the response is sent. For compliance-grade audits, the trade-off is always worth it.",[431,920,921],{"id":428},[418,922,923],{},"signed()",[414,925,926,929],{},[418,927,928],{},"signed(drain, opts)"," adds tamper-evident integrity. Two strategies:",[931,932,933,949],"table",{},[934,935,936],"thead",{},[937,938,939,943,946],"tr",{},[940,941,942],"th",{},"Strategy",[940,944,945],{},"What it adds",[940,947,948],{},"Use case",[950,951,952,969],"tbody",{},[937,953,954,960,966],{},[955,956,957],"td",{},[418,958,959],{},"'hmac'",[955,961,962,965],{},[418,963,964],{},"event.audit.signature"," (HMAC of the canonical event)",[955,967,968],{},"Single-event integrity check (any later mutation fails verification).",[937,970,971,976,984],{},[955,972,973],{},[418,974,975],{},"'hash-chain'",[955,977,978,672,981],{},[418,979,980],{},"event.audit.prevHash",[418,982,983],{},"event.audit.hash",[955,985,986],{},"A verifiable chain — deletions and reordering also become detectable.",[684,988,989,995,996,1000,1001,1003],{},[687,990,991,992,994],{},"What ",[418,993,923],{}," actually buys you."," Detection, not prevention. Anyone with write access to the underlying sink can still nuke the file or table — but the chain proves ",[997,998,999],"em",{},"which"," events were dropped or modified after the fact. Skip ",[418,1002,923],{}," if you already write to an append-only \u002F WORM store (S3 Object Lock, Postgres with row-level immutability, BigQuery append-only tables); doubling integrity layers just adds latency without raising the bar.",[1005,1006,1008],"h3",{"id":1007},"hmac","HMAC",[414,1010,1011],{},"Each event gets a signature. Tampering with one row breaks that row's verification, but doesn't break later rows.",[447,1013,1015],{"className":449,"code":1014,"language":452,"meta":453,"style":453},"import { signed } from 'evlog'\n\nsigned(drain, { strategy: 'hmac', secret: process.env.AUDIT_SECRET! })\n",[418,1016,1017,1036,1040],{"__ignoreMap":453},[457,1018,1019,1021,1023,1026,1028,1030,1032,1034],{"class":459,"line":460},[457,1020,464],{"class":463},[457,1022,468],{"class":467},[457,1024,1025],{"class":471}," signed",[457,1027,475],{"class":467},[457,1029,478],{"class":463},[457,1031,481],{"class":467},[457,1033,485],{"class":484},[457,1035,488],{"class":467},[457,1037,1038],{"class":459,"line":491},[457,1039,495],{"emptyLinePlaceholder":494},[457,1041,1042,1044,1047,1049,1051,1054,1056,1058,1060,1062,1064,1067,1069,1071,1073,1075,1077,1080,1083,1085],{"class":459,"line":498},[457,1043,428],{"class":512},[457,1045,1046],{"class":471},"(drain",[457,1048,527],{"class":467},[457,1050,468],{"class":467},[457,1052,1053],{"class":618}," strategy",[457,1055,577],{"class":467},[457,1057,481],{"class":467},[457,1059,1007],{"class":484},[457,1061,519],{"class":467},[457,1063,527],{"class":467},[457,1065,1066],{"class":618}," secret",[457,1068,577],{"class":467},[457,1070,831],{"class":471},[457,1072,504],{"class":467},[457,1074,836],{"class":471},[457,1076,504],{"class":467},[457,1078,1079],{"class":471},"AUDIT_SECRET",[457,1081,1082],{"class":467},"!",[457,1084,475],{"class":467},[457,1086,912],{"class":471},[1005,1088,1090],{"id":1089},"hash-chain","Hash-chain",[414,1092,1093],{},"Each event references the previous event's hash. Deleting any row breaks the chain forward of that point, so the verifier can pinpoint the exact row that was tampered with.",[447,1095,1097],{"className":449,"code":1096,"language":452,"meta":453,"style":453},"signed(drain, {\n  strategy: 'hash-chain',\n  state: {\n    load: () => fs.readFile('.audit\u002Fhead', 'utf8').catch(() => null),\n    save: (h) => fs.writeFile('.audit\u002Fhead', h),\n  },\n})\n",[418,1098,1099,1110,1125,1134,1193,1232,1237],{"__ignoreMap":453},[457,1100,1101,1103,1105,1107],{"class":459,"line":460},[457,1102,428],{"class":512},[457,1104,1046],{"class":471},[457,1106,527],{"class":467},[457,1108,1109],{"class":467}," {\n",[457,1111,1112,1115,1117,1119,1121,1123],{"class":459,"line":491},[457,1113,1114],{"class":618},"  strategy",[457,1116,577],{"class":467},[457,1118,481],{"class":467},[457,1120,1089],{"class":484},[457,1122,519],{"class":467},[457,1124,613],{"class":467},[457,1126,1127,1130,1132],{"class":459,"line":498},[457,1128,1129],{"class":618},"  state",[457,1131,577],{"class":467},[457,1133,1109],{"class":467},[457,1135,1136,1139,1141,1144,1146,1149,1151,1154,1156,1158,1161,1163,1165,1167,1170,1172,1174,1176,1179,1181,1184,1186,1189,1191],{"class":459,"line":652},[457,1137,1138],{"class":512},"    load",[457,1140,577],{"class":467},[457,1142,1143],{"class":467}," ()",[457,1145,585],{"class":584},[457,1147,1148],{"class":471}," fs",[457,1150,504],{"class":467},[457,1152,1153],{"class":512},"readFile",[457,1155,516],{"class":471},[457,1157,519],{"class":467},[457,1159,1160],{"class":484},".audit\u002Fhead",[457,1162,519],{"class":467},[457,1164,527],{"class":467},[457,1166,481],{"class":467},[457,1168,1169],{"class":484},"utf8",[457,1171,519],{"class":467},[457,1173,846],{"class":471},[457,1175,504],{"class":467},[457,1177,1178],{"class":512},"catch",[457,1180,516],{"class":471},[457,1182,1183],{"class":467},"()",[457,1185,585],{"class":584},[457,1187,1188],{"class":467}," null",[457,1190,846],{"class":471},[457,1192,613],{"class":467},[457,1194,1195,1198,1200,1203,1206,1208,1210,1212,1214,1217,1219,1221,1223,1225,1227,1230],{"class":459,"line":773},[457,1196,1197],{"class":512},"    save",[457,1199,577],{"class":467},[457,1201,1202],{"class":467}," (",[457,1204,1205],{"class":580},"h",[457,1207,846],{"class":467},[457,1209,585],{"class":584},[457,1211,1148],{"class":471},[457,1213,504],{"class":467},[457,1215,1216],{"class":512},"writeFile",[457,1218,516],{"class":471},[457,1220,519],{"class":467},[457,1222,1160],{"class":484},[457,1224,519],{"class":467},[457,1226,527],{"class":467},[457,1228,1229],{"class":471}," h)",[457,1231,613],{"class":467},[457,1233,1234],{"class":459,"line":802},[457,1235,1236],{"class":467},"  },\n",[457,1238,1239,1241],{"class":459,"line":851},[457,1240,655],{"class":467},[457,1242,912],{"class":471},[414,1244,915,1245,1248],{},[418,1246,1247],{},"state"," config is required for cross-process or durable chains: load the previous head hash from your own store (Redis, Postgres, file) before each event, save the new head after.",[1250,1251],"hash-chain-tamper",{},[1253,1254,1255,1256,1259,1260,1263,1264,504],"note",{},"A CLI to walk and verify the chain (",[418,1257,1258],{},"evlog audit verify",") is on the roadmap. Until then, validate by recomputing the hashes of stored events and comparing each ",[418,1261,1262],{},"prevHash"," against the previous event's ",[418,1265,1266],{},"hash",[1268,1269,1270],"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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}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}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}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 .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 .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":453,"searchDepth":491,"depth":491,"links":1272},[1273,1274,1275],{"id":433,"depth":491,"text":436},{"id":679,"depth":491,"text":682},{"id":428,"depth":491,"text":923,"children":1276},[1277,1278],{"id":1007,"depth":498,"text":1008},{"id":1089,"depth":498,"text":1090},"auditEnricher to auto-fill request context, auditOnly to route audits to a dedicated sink, and signed for tamper-evident HMAC or hash-chain integrity.","md",[1282,1285],{"label":142,"icon":145,"to":143,"color":1283,"variant":1284},"neutral","subtle",{"label":152,"icon":129,"to":153,"color":1283,"variant":1284},{},{"title":147,"icon":150},{"title":409,"description":1279},"_3JRqd31dDWZXAN9m-j4Ikhyg3JwAr_LT4cmpgR6ppw",[1291,1293],{"title":142,"path":143,"stem":144,"description":1292,"icon":145,"children":-1},"log.audit, log.audit.deny, standalone audit(), withAudit auto-instrumentation, defineAuditAction and defineAuditCatalog registries, and auditDiff change patches.",{"title":152,"path":153,"stem":154,"description":1294,"icon":129,"children":-1},"Integrity, redact presets, GDPR vs append-only, retention windows, and the most common pitfalls when shipping audit logs to production.",1778327129888]