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