[{"data":1,"prerenderedAt":1710},["ShallowReactive",2],{"navigation_docs":3,"-adapters-self-hosted-nuxthub":402,"-adapters-self-hosted-nuxthub-surround":1705},[4,35,159,201,289,299,386],{"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],{"title":295,"path":296,"stem":297,"icon":298},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F4.fs-reader","i-lucide-folder-search",{"title":300,"path":301,"stem":302,"children":303,"page":34},"Adapters","\u002Fadapters","6.adapters",[304,307,347,362],{"title":41,"path":305,"stem":306,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":308,"path":309,"stem":310,"children":311,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[312,317,322,327,332,337,342],{"title":313,"path":314,"stem":315,"icon":316},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":318,"path":319,"stem":320,"icon":321},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":323,"path":324,"stem":325,"icon":326},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":328,"path":329,"stem":330,"icon":331},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":333,"path":334,"stem":335,"icon":336},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":338,"path":339,"stem":340,"icon":341},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":343,"path":344,"stem":345,"icon":346},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":348,"path":349,"stem":350,"children":351,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[352,357],{"title":353,"path":354,"stem":355,"icon":356},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":358,"path":359,"stem":360,"icon":361},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":363,"path":364,"stem":365,"children":366,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[367,372,377,381],{"title":368,"path":369,"stem":370,"icon":371},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":373,"path":374,"stem":375,"icon":376},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":378,"path":379,"stem":380,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":382,"path":383,"stem":384,"icon":385},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":387,"path":388,"stem":389,"children":390,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[391,394,398],{"title":41,"path":392,"stem":393,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":395,"path":396,"stem":397,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":399,"path":400,"stem":401,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":403,"title":404,"body":405,"description":1691,"extension":1692,"links":1693,"meta":1701,"navigation":1702,"path":359,"seo":1703,"stem":360,"__hash__":1704},"docs\u002F6.adapters\u002F03.self-hosted\u002F02.nuxthub.md","NuxtHub Storage",{"type":406,"value":407,"toc":1673},"minimark",[408,416,463,468,471,498,503,507,587,594,617,621,627,741,754,757,787,802,806,814,824,829,839,1058,1075,1079,1082,1100,1107,1111,1119,1222,1226,1231,1234,1239,1321,1324,1387,1391,1398,1468,1477,1481,1484,1497,1504,1533,1536,1540,1551,1636,1642,1646,1653,1657,1669],[409,410,411,415],"p",{},[412,413,414],"code",{},"@evlog\u002Fnuxthub"," stores your evlog wide events directly in your NuxtHub database. No external logging service needed. Your logs live next to your data, with automatic cleanup based on a retention policy.",[417,418,421,424,449],"prompt",{":actions":419,"description":420,"icon":361},"[\"copy\",\"cursor\",\"windsurf\"]","Store evlog wide events in NuxtHub",[409,422,423],{},"Store evlog wide events in my NuxtHub database (self-hosted log retention).",[425,426,427,431,434,437,440,443,446],"ul",{},[428,429,430],"li",{},"Install both modules: pnpm add @nuxthub\u002Fcore @evlog\u002Fnuxthub",[428,432,433],{},"Add @nuxthub\u002Fcore and @evlog\u002Fnuxthub to nuxt.config.ts modules (in that order)",[428,435,436],{},"Enable hub.database = true in nuxt.config.ts",[428,438,439],{},"Configure evlog.nuxthub: { retentionDays, batchSize, ... } for retention and batching",[428,441,442],{},"Run database migrations so the wide-events table is created",[428,444,445],{},"Confirm wide events are written to my NuxtHub database after triggering a request",[428,447,448],{},"For production at scale, combine with an external drain (Axiom \u002F OTLP) for long-term storage",[409,450,451,452,458,459],{},"Docs: ",[453,454,455],"a",{"href":455,"rel":456},"https:\u002F\u002Fwww.evlog.dev\u002Fadapters\u002Fself-hosted\u002Fnuxthub",[457],"nofollow","\nNuxtHub: ",[453,460,461],{"href":461,"rel":462},"https:\u002F\u002Fhub.nuxt.com",[457],[464,465,467],"h2",{"id":466},"why-self-hosted-logs","Why Self-Hosted Logs?",[409,469,470],{},"External logging services (Axiom, Datadog, etc.) are great for production at scale. But sometimes you want:",[425,472,473,480,486,492],{},[428,474,475,479],{},[476,477,478],"strong",{},"Zero external dependencies"," - logs stored in the same database as your app",[428,481,482,485],{},[476,483,484],{},"Full data ownership"," - no third-party access to your log data",[428,487,488,491],{},[476,489,490],{},"Free tier friendly"," - no per-event pricing, just your existing database",[428,493,494,497],{},[476,495,496],{},"Development & staging"," - full log visibility without paying for a service",[409,499,500,502],{},[412,501,414],{}," works as a drop-in drain. Your existing evlog setup stays the same, you just get a database-backed storage layer on top.",[464,504,506],{"id":505},"install","Install",[508,509,510,538,554,570],"code-group",{},[511,512,518],"pre",{"className":513,"code":514,"filename":515,"language":516,"meta":517,"style":517},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","pnpm","bash","",[412,519,520],{"__ignoreMap":517},[521,522,525,528,532,535],"span",{"class":523,"line":524},"line",1,[521,526,515],{"class":527},"sBMFI",[521,529,531],{"class":530},"sfazB"," add",[521,533,534],{"class":530}," @nuxthub\u002Fcore",[521,536,537],{"class":530}," @evlog\u002Fnuxthub\n",[511,539,542],{"className":513,"code":540,"filename":541,"language":516,"meta":517,"style":517},"bun add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","bun",[412,543,544],{"__ignoreMap":517},[521,545,546,548,550,552],{"class":523,"line":524},[521,547,541],{"class":527},[521,549,531],{"class":530},[521,551,534],{"class":530},[521,553,537],{"class":530},[511,555,558],{"className":513,"code":556,"filename":557,"language":516,"meta":517,"style":517},"yarn add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","yarn",[412,559,560],{"__ignoreMap":517},[521,561,562,564,566,568],{"class":523,"line":524},[521,563,557],{"class":527},[521,565,531],{"class":530},[521,567,534],{"class":530},[521,569,537],{"class":530},[511,571,574],{"className":513,"code":572,"filename":573,"language":516,"meta":517,"style":517},"npm install @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","npm",[412,575,576],{"__ignoreMap":517},[521,577,578,580,583,585],{"class":523,"line":524},[521,579,573],{"class":527},[521,581,582],{"class":530}," install",[521,584,534],{"class":530},[521,586,537],{"class":530},[409,588,589,590,593],{},"Or with ",[412,591,592],{},"nuxi",":",[511,595,598],{"className":513,"code":596,"filename":597,"language":516,"meta":517,"style":517},"npx nuxi module add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","Terminal",[412,599,600],{"__ignoreMap":517},[521,601,602,605,608,611,613,615],{"class":523,"line":524},[521,603,604],{"class":527},"npx",[521,606,607],{"class":530}," nuxi",[521,609,610],{"class":530}," module",[521,612,531],{"class":530},[521,614,534],{"class":530},[521,616,537],{"class":530},[464,618,620],{"id":619},"setup","Setup",[409,622,623,624,593],{},"Add the module to your ",[412,625,626],{},"nuxt.config.ts",[511,628,632],{"className":629,"code":630,"filename":626,"language":631,"meta":517,"style":517},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  modules: ['@nuxthub\u002Fcore', '@evlog\u002Fnuxthub'],\n\n  evlog: {\n    retention: '7d',\n  },\n})\n","typescript",[412,633,634,655,691,698,709,726,732],{"__ignoreMap":517},[521,635,636,640,643,647,651],{"class":523,"line":524},[521,637,639],{"class":638},"s7zQu","export",[521,641,642],{"class":638}," default",[521,644,646],{"class":645},"s2Zo4"," defineNuxtConfig",[521,648,650],{"class":649},"sTEyZ","(",[521,652,654],{"class":653},"sMK4o","{\n",[521,656,658,662,664,667,670,673,675,678,681,683,685,688],{"class":523,"line":657},2,[521,659,661],{"class":660},"swJcz","  modules",[521,663,593],{"class":653},[521,665,666],{"class":649}," [",[521,668,669],{"class":653},"'",[521,671,672],{"class":530},"@nuxthub\u002Fcore",[521,674,669],{"class":653},[521,676,677],{"class":653},",",[521,679,680],{"class":653}," '",[521,682,414],{"class":530},[521,684,669],{"class":653},[521,686,687],{"class":649},"]",[521,689,690],{"class":653},",\n",[521,692,694],{"class":523,"line":693},3,[521,695,697],{"emptyLinePlaceholder":696},true,"\n",[521,699,701,704,706],{"class":523,"line":700},4,[521,702,703],{"class":660},"  evlog",[521,705,593],{"class":653},[521,707,708],{"class":653}," {\n",[521,710,712,715,717,719,722,724],{"class":523,"line":711},5,[521,713,714],{"class":660},"    retention",[521,716,593],{"class":653},[521,718,680],{"class":653},[521,720,721],{"class":530},"7d",[521,723,669],{"class":653},[521,725,690],{"class":653},[521,727,729],{"class":523,"line":728},6,[521,730,731],{"class":653},"  },\n",[521,733,735,738],{"class":523,"line":734},7,[521,736,737],{"class":653},"}",[521,739,740],{"class":649},")\n",[409,742,743,744,746,747,749,750,753],{},"Even if ",[412,745,414],{}," can auto-register missing modules, we recommend explicitly installing ",[412,748,672],{}," and registering it in ",[412,751,752],{},"modules"," for a clearer and more predictable setup.",[409,755,756],{},"That's it. The module automatically:",[758,759,760,770,777,784],"ol",{},[428,761,762,763,766,767,769],{},"Installs ",[412,764,765],{},"evlog\u002Fnuxt"," and ",[412,768,672],{}," if not already registered",[428,771,772,773,776],{},"Registers the ",[412,774,775],{},"evlog_events"," database schema with NuxtHub",[428,778,779,780,783],{},"Hooks into ",[412,781,782],{},"evlog:drain"," to store every event in the database",[428,785,786],{},"Schedules a cleanup task based on your retention policy",[788,789,791,794,795,798,799,801],"callout",{"color":790,"icon":13},"info",[476,792,793],{},"Prerequisites:"," Your project must use ",[453,796,358],{"href":461,"rel":797},[457]," with a database configured. ",[412,800,414],{}," uses Drizzle ORM to interact with the database.",[464,803,805],{"id":804},"how-it-works","How It Works",[511,807,812],{"className":808,"code":810,"language":811},[809],"language-text","Request → evlog wide event → evlog:drain hook → INSERT into evlog_events table\n                                                          ↓\n                          Cron task (automatic) → DELETE events older than retention\n","text",[412,813,810],{"__ignoreMap":517},[409,815,816,817,819,820,823],{},"Every wide event emitted by evlog is stored as a row in the ",[412,818,775],{}," table. The drain plugin handles both single events and batches (when used with the ",[453,821,822],{"href":369},"pipeline",").",[825,826,828],"h3",{"id":827},"database-schema","Database Schema",[409,830,831,832,834,835,838],{},"The ",[412,833,775],{}," table stores indexed columns for fast querying and a ",[412,836,837],{},"data"," JSON column for all remaining fields:",[840,841,842,858],"table",{},[843,844,845],"thead",{},[846,847,848,852,855],"tr",{},[849,850,851],"th",{},"Column",[849,853,854],{},"Type",[849,856,857],{},"Description",[859,860,861,876,890,904,918,932,946,960,975,989,1003,1017,1031,1044],"tbody",{},[846,862,863,869,873],{},[864,865,866],"td",{},[412,867,868],{},"id",[864,870,871],{},[412,872,811],{},[864,874,875],{},"UUID primary key",[846,877,878,883,887],{},[864,879,880],{},[412,881,882],{},"timestamp",[864,884,885],{},[412,886,811],{},[864,888,889],{},"Event timestamp",[846,891,892,897,901],{},[864,893,894],{},[412,895,896],{},"level",[864,898,899],{},[412,900,811],{},[864,902,903],{},"Log level (info, warn, error, debug)",[846,905,906,911,915],{},[864,907,908],{},[412,909,910],{},"service",[864,912,913],{},[412,914,811],{},[864,916,917],{},"Service name",[846,919,920,925,929],{},[864,921,922],{},[412,923,924],{},"environment",[864,926,927],{},[412,928,811],{},[864,930,931],{},"Environment (production, staging, etc.)",[846,933,934,939,943],{},[864,935,936],{},[412,937,938],{},"method",[864,940,941],{},[412,942,811],{},[864,944,945],{},"HTTP method",[846,947,948,953,957],{},[864,949,950],{},[412,951,952],{},"path",[864,954,955],{},[412,956,811],{},[864,958,959],{},"Request path",[846,961,962,967,972],{},[864,963,964],{},[412,965,966],{},"status",[864,968,969],{},[412,970,971],{},"integer",[864,973,974],{},"HTTP status code",[846,976,977,982,986],{},[864,978,979],{},[412,980,981],{},"duration_ms",[864,983,984],{},[412,985,971],{},[864,987,988],{},"Request duration in milliseconds",[846,990,991,996,1000],{},[864,992,993],{},[412,994,995],{},"request_id",[864,997,998],{},[412,999,811],{},[864,1001,1002],{},"Request correlation ID",[846,1004,1005,1010,1014],{},[864,1006,1007],{},[412,1008,1009],{},"source",[864,1011,1012],{},[412,1013,811],{},[864,1015,1016],{},"Event source (server, client)",[846,1018,1019,1024,1028],{},[864,1020,1021],{},[412,1022,1023],{},"error",[864,1025,1026],{},[412,1027,811],{},[864,1029,1030],{},"Error details (JSON string)",[846,1032,1033,1037,1041],{},[864,1034,1035],{},[412,1036,837],{},[864,1038,1039],{},[412,1040,811],{},[864,1042,1043],{},"All remaining event fields (JSON)",[846,1045,1046,1051,1055],{},[864,1047,1048],{},[412,1049,1050],{},"created_at",[864,1052,1053],{},[412,1054,811],{},[864,1056,1057],{},"Row insertion timestamp",[409,1059,1060,1061,1063,1064,1063,1066,1063,1068,1063,1070,1063,1072,1074],{},"Indexed columns: ",[412,1062,882],{},", ",[412,1065,896],{},[412,1067,910],{},[412,1069,966],{},[412,1071,995],{},[412,1073,1050],{},".",[825,1076,1078],{"id":1077},"dialect-support","Dialect Support",[409,1080,1081],{},"The schema is automatically registered for your NuxtHub database dialect:",[425,1083,1084,1090,1095],{},[428,1085,1086,1089],{},[476,1087,1088],{},"SQLite"," (default for Cloudflare D1)",[428,1091,1092],{},[476,1093,1094],{},"MySQL",[428,1096,1097],{},[476,1098,1099],{},"PostgreSQL",[409,1101,1102,1103,1106],{},"The correct schema is selected via the ",[412,1104,1105],{},"hub:db:schema:extend"," hook based on your NuxtHub configuration.",[464,1108,1110],{"id":1109},"combining-with-external-adapters","Combining with External Adapters",[409,1112,1113,1115,1116,1118],{},[412,1114,414],{}," doesn't replace external adapters, you can use both. The module registers its own ",[412,1117,782],{}," hook, so any other drain plugins you have will still work:",[511,1120,1123],{"className":629,"code":1121,"filename":1122,"language":631,"meta":517,"style":517},"import { createAxiomDrain } from 'evlog\u002Faxiom'\n\nexport default defineNitroPlugin((nitroApp) => {\n  \u002F\u002F This runs alongside @evlog\u002Fnuxthub's built-in drain\n  nitroApp.hooks.hook('evlog:drain', createAxiomDrain())\n})\n","server\u002Fplugins\u002Fevlog-drain.ts",[412,1124,1125,1150,1154,1180,1186,1216],{"__ignoreMap":517},[521,1126,1127,1130,1133,1136,1139,1142,1144,1147],{"class":523,"line":524},[521,1128,1129],{"class":638},"import",[521,1131,1132],{"class":653}," {",[521,1134,1135],{"class":649}," createAxiomDrain",[521,1137,1138],{"class":653}," }",[521,1140,1141],{"class":638}," from",[521,1143,680],{"class":653},[521,1145,1146],{"class":530},"evlog\u002Faxiom",[521,1148,1149],{"class":653},"'\n",[521,1151,1152],{"class":523,"line":657},[521,1153,697],{"emptyLinePlaceholder":696},[521,1155,1156,1158,1160,1163,1165,1167,1171,1174,1178],{"class":523,"line":693},[521,1157,639],{"class":638},[521,1159,642],{"class":638},[521,1161,1162],{"class":645}," defineNitroPlugin",[521,1164,650],{"class":649},[521,1166,650],{"class":653},[521,1168,1170],{"class":1169},"sHdIc","nitroApp",[521,1172,1173],{"class":653},")",[521,1175,1177],{"class":1176},"spNyl"," =>",[521,1179,708],{"class":653},[521,1181,1182],{"class":523,"line":700},[521,1183,1185],{"class":1184},"sHwdD","  \u002F\u002F This runs alongside @evlog\u002Fnuxthub's built-in drain\n",[521,1187,1188,1191,1193,1196,1198,1201,1203,1205,1207,1209,1211,1213],{"class":523,"line":711},[521,1189,1190],{"class":649},"  nitroApp",[521,1192,1074],{"class":653},[521,1194,1195],{"class":649},"hooks",[521,1197,1074],{"class":653},[521,1199,1200],{"class":645},"hook",[521,1202,650],{"class":660},[521,1204,669],{"class":653},[521,1206,782],{"class":530},[521,1208,669],{"class":653},[521,1210,677],{"class":653},[521,1212,1135],{"class":645},[521,1214,1215],{"class":660},"())\n",[521,1217,1218,1220],{"class":523,"line":728},[521,1219,737],{"class":653},[521,1221,740],{"class":649},[464,1223,1225],{"id":1224},"retention","Retention",[409,1227,1228,1230],{},[412,1229,414],{}," automatically deletes old events based on your retention policy. No manual cleanup needed.",[825,1232,170],{"id":1233},"configuration",[409,1235,1236,1237,593],{},"Set the retention period in your ",[412,1238,626],{},[511,1240,1242],{"className":629,"code":1241,"filename":626,"language":631,"meta":517,"style":517},"export default defineNuxtConfig({\n  modules: ['@nuxthub\u002Fcore', '@evlog\u002Fnuxthub'],\n\n  evlog: {\n    retention: '7d', \u002F\u002F default\n  },\n})\n",[412,1243,1244,1256,1282,1286,1294,1311,1315],{"__ignoreMap":517},[521,1245,1246,1248,1250,1252,1254],{"class":523,"line":524},[521,1247,639],{"class":638},[521,1249,642],{"class":638},[521,1251,646],{"class":645},[521,1253,650],{"class":649},[521,1255,654],{"class":653},[521,1257,1258,1260,1262,1264,1266,1268,1270,1272,1274,1276,1278,1280],{"class":523,"line":657},[521,1259,661],{"class":660},[521,1261,593],{"class":653},[521,1263,666],{"class":649},[521,1265,669],{"class":653},[521,1267,672],{"class":530},[521,1269,669],{"class":653},[521,1271,677],{"class":653},[521,1273,680],{"class":653},[521,1275,414],{"class":530},[521,1277,669],{"class":653},[521,1279,687],{"class":649},[521,1281,690],{"class":653},[521,1283,1284],{"class":523,"line":693},[521,1285,697],{"emptyLinePlaceholder":696},[521,1287,1288,1290,1292],{"class":523,"line":700},[521,1289,703],{"class":660},[521,1291,593],{"class":653},[521,1293,708],{"class":653},[521,1295,1296,1298,1300,1302,1304,1306,1308],{"class":523,"line":711},[521,1297,714],{"class":660},[521,1299,593],{"class":653},[521,1301,680],{"class":653},[521,1303,721],{"class":530},[521,1305,669],{"class":653},[521,1307,677],{"class":653},[521,1309,1310],{"class":1184}," \u002F\u002F default\n",[521,1312,1313],{"class":523,"line":728},[521,1314,731],{"class":653},[521,1316,1317,1319],{"class":523,"line":734},[521,1318,737],{"class":653},[521,1320,740],{"class":649},[409,1322,1323],{},"The retention value is a number followed by a unit:",[840,1325,1326,1338],{},[843,1327,1328],{},[846,1329,1330,1333,1335],{},[849,1331,1332],{},"Unit",[849,1334,857],{},[849,1336,1337],{},"Example",[859,1339,1340,1355,1371],{},[846,1341,1342,1347,1350],{},[864,1343,1344],{},[412,1345,1346],{},"d",[864,1348,1349],{},"Days",[864,1351,1352,1354],{},[412,1353,721],{}," = 7 days",[846,1356,1357,1362,1365],{},[864,1358,1359],{},[412,1360,1361],{},"h",[864,1363,1364],{},"Hours",[864,1366,1367,1370],{},[412,1368,1369],{},"24h"," = 24 hours",[846,1372,1373,1378,1381],{},[864,1374,1375],{},[412,1376,1377],{},"m",[864,1379,1380],{},"Minutes",[864,1382,1383,1386],{},[412,1384,1385],{},"60m"," = 60 minutes",[825,1388,1390],{"id":1389},"how-cleanup-works","How Cleanup Works",[409,1392,1393,1394,1397],{},"The module registers a Nitro scheduled task (",[412,1395,1396],{},"evlog:cleanup",") that runs on a cron schedule derived from your retention value. The cron frequency is set to roughly half the retention period:",[840,1399,1400,1411],{},[843,1401,1402],{},[846,1403,1404,1406,1409],{},[849,1405,1225],{},[849,1407,1408],{},"Cron Schedule",[849,1410,857],{},[859,1412,1413,1427,1441,1455],{},[846,1414,1415,1419,1424],{},[864,1416,1417],{},[412,1418,1385],{},[864,1420,1421],{},[412,1422,1423],{},"*\u002F30 * * * *",[864,1425,1426],{},"Every 30 minutes",[846,1428,1429,1433,1438],{},[864,1430,1431],{},[412,1432,1369],{},[864,1434,1435],{},[412,1436,1437],{},"0 *\u002F12 * * *",[864,1439,1440],{},"Every 12 hours",[846,1442,1443,1447,1452],{},[864,1444,1445],{},[412,1446,721],{},[864,1448,1449],{},[412,1450,1451],{},"0 3 * * *",[864,1453,1454],{},"Daily at 3:00 AM",[846,1456,1457,1462,1466],{},[864,1458,1459],{},[412,1460,1461],{},"30d",[864,1463,1464],{},[412,1465,1451],{},[864,1467,1454],{},[409,1469,1470,1471,1473,1474,1476],{},"The cleanup task deletes all rows in ",[412,1472,775],{}," where ",[412,1475,1050],{}," is older than the retention period.",[825,1478,1480],{"id":1479},"manual-cleanup","Manual Cleanup",[409,1482,1483],{},"You can trigger cleanup manually via the API endpoint:",[511,1485,1487],{"className":513,"code":1486,"filename":597,"language":516,"meta":517,"style":517},"curl https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[412,1488,1489],{"__ignoreMap":517},[521,1490,1491,1494],{"class":523,"line":524},[521,1492,1493],{"class":527},"curl",[521,1495,1496],{"class":530}," https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[409,1498,1499,1500,1503],{},"If the ",[412,1501,1502],{},"CRON_SECRET"," environment variable is set, the endpoint requires a Bearer token:",[511,1505,1507],{"className":513,"code":1506,"filename":597,"language":516,"meta":517,"style":517},"curl -H \"Authorization: Bearer your-secret\" \\\n  https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[412,1508,1509,1528],{"__ignoreMap":517},[521,1510,1511,1513,1516,1519,1522,1525],{"class":523,"line":524},[521,1512,1493],{"class":527},[521,1514,1515],{"class":530}," -H",[521,1517,1518],{"class":653}," \"",[521,1520,1521],{"class":530},"Authorization: Bearer your-secret",[521,1523,1524],{"class":653},"\"",[521,1526,1527],{"class":649}," \\\n",[521,1529,1530],{"class":523,"line":657},[521,1531,1532],{"class":530},"  https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[409,1534,1535],{},"This is recommended for production deployments to prevent unauthorized cleanup triggers.",[825,1537,1539],{"id":1538},"vercel-cron","Vercel Cron",[409,1541,1542,1543,1546,1547,1550],{},"When installing the module with ",[412,1544,1545],{},"nuxi module add",", you'll be prompted to create a ",[412,1548,1549],{},"vercel.json"," with the appropriate cron schedule:",[511,1552,1556],{"className":1553,"code":1554,"filename":1549,"language":1555,"meta":517,"style":517},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"crons\": [\n    {\n      \"path\": \"\u002Fapi\u002F_cron\u002Fevlog-cleanup\",\n      \"schedule\": \"0 3 * * *\"\n    }\n  ]\n}\n","json",[412,1557,1558,1562,1577,1582,1602,1620,1625,1630],{"__ignoreMap":517},[521,1559,1560],{"class":523,"line":524},[521,1561,654],{"class":653},[521,1563,1564,1567,1570,1572,1574],{"class":523,"line":657},[521,1565,1566],{"class":653},"  \"",[521,1568,1569],{"class":1176},"crons",[521,1571,1524],{"class":653},[521,1573,593],{"class":653},[521,1575,1576],{"class":653}," [\n",[521,1578,1579],{"class":523,"line":693},[521,1580,1581],{"class":653},"    {\n",[521,1583,1584,1587,1589,1591,1593,1595,1598,1600],{"class":523,"line":700},[521,1585,1586],{"class":653},"      \"",[521,1588,952],{"class":527},[521,1590,1524],{"class":653},[521,1592,593],{"class":653},[521,1594,1518],{"class":653},[521,1596,1597],{"class":530},"\u002Fapi\u002F_cron\u002Fevlog-cleanup",[521,1599,1524],{"class":653},[521,1601,690],{"class":653},[521,1603,1604,1606,1609,1611,1613,1615,1617],{"class":523,"line":711},[521,1605,1586],{"class":653},[521,1607,1608],{"class":527},"schedule",[521,1610,1524],{"class":653},[521,1612,593],{"class":653},[521,1614,1518],{"class":653},[521,1616,1451],{"class":530},[521,1618,1619],{"class":653},"\"\n",[521,1621,1622],{"class":523,"line":728},[521,1623,1624],{"class":653},"    }\n",[521,1626,1627],{"class":523,"line":734},[521,1628,1629],{"class":653},"  ]\n",[521,1631,1633],{"class":523,"line":1632},8,[521,1634,1635],{"class":653},"}\n",[409,1637,1638,1639,1641],{},"On Vercel, the ",[412,1640,1502],{}," environment variable is automatically set and validated.",[825,1643,1645],{"id":1644},"cloudflare-other-platforms","Cloudflare & Other Platforms",[409,1647,1648,1649,1652],{},"On Cloudflare Workers and other platforms, the Nitro scheduled task handles cleanup automatically without any additional cron configuration. The task is registered with ",[412,1650,1651],{},"experimental.tasks"," enabled in the Nitro config.",[464,1654,1656],{"id":1655},"next-steps","Next Steps",[425,1658,1659,1664],{},[428,1660,1661,1663],{},[453,1662,300],{"href":305}," - Send logs to external services alongside NuxtHub storage",[428,1665,1666,1668],{},[453,1667,368],{"href":369}," - Batch events for better database performance",[1670,1671,1672],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}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 .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}",{"title":517,"searchDepth":657,"depth":657,"links":1674},[1675,1676,1677,1678,1682,1683,1690],{"id":466,"depth":657,"text":467},{"id":505,"depth":657,"text":506},{"id":619,"depth":657,"text":620},{"id":804,"depth":657,"text":805,"children":1679},[1680,1681],{"id":827,"depth":693,"text":828},{"id":1077,"depth":693,"text":1078},{"id":1109,"depth":657,"text":1110},{"id":1224,"depth":657,"text":1225,"children":1684},[1685,1686,1687,1688,1689],{"id":1233,"depth":693,"text":170},{"id":1389,"depth":693,"text":1390},{"id":1479,"depth":693,"text":1480},{"id":1538,"depth":693,"text":1539},{"id":1644,"depth":693,"text":1645},{"id":1655,"depth":657,"text":1656},"Self-hosted log retention for evlog using NuxtHub database storage. Store, query, and automatically clean up your structured logs with zero external dependencies.","md",[1694,1699],{"label":358,"icon":1695,"to":461,"target":1696,"color":1697,"variant":1698},"i-lucide-external-link","_blank","neutral","subtle",{"label":300,"icon":1700,"to":305,"color":1697,"variant":1698},"i-custom-plug",{},{"title":358,"icon":361},{"title":404,"description":1691},"7IAyh9YhgeYDG6zRJWByEW2QvSef3_48EfOsdchlpRY",[1706,1708],{"title":353,"path":354,"stem":355,"description":1707,"icon":356,"children":-1},"Write wide events to the local file system as NDJSON for local debugging, AI agent integration, and production backup.",{"title":368,"path":369,"stem":370,"description":1709,"icon":371,"children":-1},"Batch events, retry on failure, and protect against buffer overflow with the shared drain pipeline. Supports fan-out to multiple adapters.",1778325972137]