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