[{"data":1,"prerenderedAt":1737},["ShallowReactive",2],{"navigation_docs":3,"-adapters-self-hosted-nuxthub":429,"-adapters-self-hosted-nuxthub-surround":1732},[4,35,159,201,289,326,413],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,99,127],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,297,302,307,312,317,321],{"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 API","\u002Fbuild-on-top\u002Fstream-api","5.build-on-top\u002F1.stream-api","i-lucide-radio-tower",{"title":303,"path":304,"stem":305,"icon":306},"Stream server","\u002Fbuild-on-top\u002Fstream-server","5.build-on-top\u002F2.stream-server","i-lucide-radio",{"title":308,"path":309,"stem":310,"icon":311},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F3.fs-reader","i-lucide-folder-search",{"title":313,"path":314,"stem":315,"icon":316},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F4.identity-headers","i-lucide-fingerprint",{"title":156,"path":318,"stem":319,"icon":320},"\u002Fbuild-on-top\u002Frecipes","5.build-on-top\u002F5.recipes","i-lucide-chef-hat",{"title":322,"path":323,"stem":324,"icon":325},"Catalogs as packages","\u002Fbuild-on-top\u002Fcatalogs-as-packages","5.build-on-top\u002F6.catalogs-as-packages","i-lucide-package",{"title":327,"path":328,"stem":329,"children":330,"page":34},"Adapters","\u002Fadapters","6.adapters",[331,334,374,389],{"title":41,"path":332,"stem":333,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":335,"path":336,"stem":337,"children":338,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[339,344,349,354,359,364,369],{"title":340,"path":341,"stem":342,"icon":343},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":345,"path":346,"stem":347,"icon":348},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":350,"path":351,"stem":352,"icon":353},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":355,"path":356,"stem":357,"icon":358},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":360,"path":361,"stem":362,"icon":363},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":365,"path":366,"stem":367,"icon":368},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":370,"path":371,"stem":372,"icon":373},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":375,"path":376,"stem":377,"children":378,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[379,384],{"title":380,"path":381,"stem":382,"icon":383},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":385,"path":386,"stem":387,"icon":388},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":390,"path":391,"stem":392,"children":393,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[394,399,404,408],{"title":395,"path":396,"stem":397,"icon":398},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":400,"path":401,"stem":402,"icon":403},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":405,"path":406,"stem":407,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":409,"path":410,"stem":411,"icon":412},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":414,"path":415,"stem":416,"children":417,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[418,421,425],{"title":41,"path":419,"stem":420,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":422,"path":423,"stem":424,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":426,"path":427,"stem":428,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":430,"title":431,"body":432,"description":1718,"extension":1719,"links":1720,"meta":1728,"navigation":1729,"path":386,"seo":1730,"stem":387,"__hash__":1731},"docs\u002F6.adapters\u002F03.self-hosted\u002F02.nuxthub.md","NuxtHub Storage",{"type":433,"value":434,"toc":1700},"minimark",[435,443,490,495,498,525,530,534,614,621,644,648,654,768,781,784,814,829,833,841,851,856,866,1085,1102,1106,1109,1127,1134,1138,1146,1249,1253,1258,1261,1266,1348,1351,1414,1418,1425,1495,1504,1508,1511,1524,1531,1560,1563,1567,1578,1663,1669,1673,1680,1684,1696],[436,437,438,442],"p",{},[439,440,441],"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.",[444,445,448,451,476],"prompt",{":actions":446,"description":447,"icon":388},"[\"copy\",\"cursor\",\"windsurf\"]","Store evlog wide events in NuxtHub",[436,449,450],{},"Store evlog wide events in my NuxtHub database (self-hosted log retention).",[452,453,454,458,461,464,467,470,473],"ul",{},[455,456,457],"li",{},"Install both modules: pnpm add @nuxthub\u002Fcore @evlog\u002Fnuxthub",[455,459,460],{},"Add @nuxthub\u002Fcore and @evlog\u002Fnuxthub to nuxt.config.ts modules (in that order)",[455,462,463],{},"Enable hub.database = true in nuxt.config.ts",[455,465,466],{},"Configure evlog.nuxthub: { retentionDays, batchSize, ... } for retention and batching",[455,468,469],{},"Run database migrations so the wide-events table is created",[455,471,472],{},"Confirm wide events are written to my NuxtHub database after triggering a request",[455,474,475],{},"For production at scale, combine with an external drain (Axiom \u002F OTLP) for long-term storage",[436,477,478,479,485,486],{},"Docs: ",[480,481,482],"a",{"href":482,"rel":483},"https:\u002F\u002Fwww.evlog.dev\u002Fadapters\u002Fself-hosted\u002Fnuxthub",[484],"nofollow","\nNuxtHub: ",[480,487,488],{"href":488,"rel":489},"https:\u002F\u002Fhub.nuxt.com",[484],[491,492,494],"h2",{"id":493},"why-self-hosted-logs","Why Self-Hosted Logs?",[436,496,497],{},"External logging services (Axiom, Datadog, etc.) are great for production at scale. But sometimes you want:",[452,499,500,507,513,519],{},[455,501,502,506],{},[503,504,505],"strong",{},"Zero external dependencies"," - logs stored in the same database as your app",[455,508,509,512],{},[503,510,511],{},"Full data ownership"," - no third-party access to your log data",[455,514,515,518],{},[503,516,517],{},"Free tier friendly"," - no per-event pricing, just your existing database",[455,520,521,524],{},[503,522,523],{},"Development & staging"," - full log visibility without paying for a service",[436,526,527,529],{},[439,528,441],{}," works as a drop-in drain. Your existing evlog setup stays the same, you just get a database-backed storage layer on top.",[491,531,533],{"id":532},"install","Install",[535,536,537,565,581,597],"code-group",{},[538,539,545],"pre",{"className":540,"code":541,"filename":542,"language":543,"meta":544,"style":544},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","pnpm","bash","",[439,546,547],{"__ignoreMap":544},[548,549,552,555,559,562],"span",{"class":550,"line":551},"line",1,[548,553,542],{"class":554},"sBMFI",[548,556,558],{"class":557},"sfazB"," add",[548,560,561],{"class":557}," @nuxthub\u002Fcore",[548,563,564],{"class":557}," @evlog\u002Fnuxthub\n",[538,566,569],{"className":540,"code":567,"filename":568,"language":543,"meta":544,"style":544},"bun add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","bun",[439,570,571],{"__ignoreMap":544},[548,572,573,575,577,579],{"class":550,"line":551},[548,574,568],{"class":554},[548,576,558],{"class":557},[548,578,561],{"class":557},[548,580,564],{"class":557},[538,582,585],{"className":540,"code":583,"filename":584,"language":543,"meta":544,"style":544},"yarn add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","yarn",[439,586,587],{"__ignoreMap":544},[548,588,589,591,593,595],{"class":550,"line":551},[548,590,584],{"class":554},[548,592,558],{"class":557},[548,594,561],{"class":557},[548,596,564],{"class":557},[538,598,601],{"className":540,"code":599,"filename":600,"language":543,"meta":544,"style":544},"npm install @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","npm",[439,602,603],{"__ignoreMap":544},[548,604,605,607,610,612],{"class":550,"line":551},[548,606,600],{"class":554},[548,608,609],{"class":557}," install",[548,611,561],{"class":557},[548,613,564],{"class":557},[436,615,616,617,620],{},"Or with ",[439,618,619],{},"nuxi",":",[538,622,625],{"className":540,"code":623,"filename":624,"language":543,"meta":544,"style":544},"npx nuxi module add @nuxthub\u002Fcore @evlog\u002Fnuxthub\n","Terminal",[439,626,627],{"__ignoreMap":544},[548,628,629,632,635,638,640,642],{"class":550,"line":551},[548,630,631],{"class":554},"npx",[548,633,634],{"class":557}," nuxi",[548,636,637],{"class":557}," module",[548,639,558],{"class":557},[548,641,561],{"class":557},[548,643,564],{"class":557},[491,645,647],{"id":646},"setup","Setup",[436,649,650,651,620],{},"Add the module to your ",[439,652,653],{},"nuxt.config.ts",[538,655,659],{"className":656,"code":657,"filename":653,"language":658,"meta":544,"style":544},"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",[439,660,661,682,718,725,736,753,759],{"__ignoreMap":544},[548,662,663,667,670,674,678],{"class":550,"line":551},[548,664,666],{"class":665},"s7zQu","export",[548,668,669],{"class":665}," default",[548,671,673],{"class":672},"s2Zo4"," defineNuxtConfig",[548,675,677],{"class":676},"sTEyZ","(",[548,679,681],{"class":680},"sMK4o","{\n",[548,683,685,689,691,694,697,700,702,705,708,710,712,715],{"class":550,"line":684},2,[548,686,688],{"class":687},"swJcz","  modules",[548,690,620],{"class":680},[548,692,693],{"class":676}," [",[548,695,696],{"class":680},"'",[548,698,699],{"class":557},"@nuxthub\u002Fcore",[548,701,696],{"class":680},[548,703,704],{"class":680},",",[548,706,707],{"class":680}," '",[548,709,441],{"class":557},[548,711,696],{"class":680},[548,713,714],{"class":676},"]",[548,716,717],{"class":680},",\n",[548,719,721],{"class":550,"line":720},3,[548,722,724],{"emptyLinePlaceholder":723},true,"\n",[548,726,728,731,733],{"class":550,"line":727},4,[548,729,730],{"class":687},"  evlog",[548,732,620],{"class":680},[548,734,735],{"class":680}," {\n",[548,737,739,742,744,746,749,751],{"class":550,"line":738},5,[548,740,741],{"class":687},"    retention",[548,743,620],{"class":680},[548,745,707],{"class":680},[548,747,748],{"class":557},"7d",[548,750,696],{"class":680},[548,752,717],{"class":680},[548,754,756],{"class":550,"line":755},6,[548,757,758],{"class":680},"  },\n",[548,760,762,765],{"class":550,"line":761},7,[548,763,764],{"class":680},"}",[548,766,767],{"class":676},")\n",[436,769,770,771,773,774,776,777,780],{},"Even if ",[439,772,441],{}," can auto-register missing modules, we recommend explicitly installing ",[439,775,699],{}," and registering it in ",[439,778,779],{},"modules"," for a clearer and more predictable setup.",[436,782,783],{},"That's it. The module automatically:",[785,786,787,797,804,811],"ol",{},[455,788,789,790,793,794,796],{},"Installs ",[439,791,792],{},"evlog\u002Fnuxt"," and ",[439,795,699],{}," if not already registered",[455,798,799,800,803],{},"Registers the ",[439,801,802],{},"evlog_events"," database schema with NuxtHub",[455,805,806,807,810],{},"Hooks into ",[439,808,809],{},"evlog:drain"," to store every event in the database",[455,812,813],{},"Schedules a cleanup task based on your retention policy",[815,816,818,821,822,825,826,828],"callout",{"color":817,"icon":13},"info",[503,819,820],{},"Prerequisites:"," Your project must use ",[480,823,385],{"href":488,"rel":824},[484]," with a database configured. ",[439,827,441],{}," uses Drizzle ORM to interact with the database.",[491,830,832],{"id":831},"how-it-works","How It Works",[538,834,839],{"className":835,"code":837,"language":838},[836],"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",[439,840,837],{"__ignoreMap":544},[436,842,843,844,846,847,850],{},"Every wide event emitted by evlog is stored as a row in the ",[439,845,802],{}," table. The drain plugin handles both single events and batches (when used with the ",[480,848,849],{"href":396},"pipeline",").",[852,853,855],"h3",{"id":854},"database-schema","Database Schema",[436,857,858,859,861,862,865],{},"The ",[439,860,802],{}," table stores indexed columns for fast querying and a ",[439,863,864],{},"data"," JSON column for all remaining fields:",[867,868,869,885],"table",{},[870,871,872],"thead",{},[873,874,875,879,882],"tr",{},[876,877,878],"th",{},"Column",[876,880,881],{},"Type",[876,883,884],{},"Description",[886,887,888,903,917,931,945,959,973,987,1002,1016,1030,1044,1058,1071],"tbody",{},[873,889,890,896,900],{},[891,892,893],"td",{},[439,894,895],{},"id",[891,897,898],{},[439,899,838],{},[891,901,902],{},"UUID primary key",[873,904,905,910,914],{},[891,906,907],{},[439,908,909],{},"timestamp",[891,911,912],{},[439,913,838],{},[891,915,916],{},"Event timestamp",[873,918,919,924,928],{},[891,920,921],{},[439,922,923],{},"level",[891,925,926],{},[439,927,838],{},[891,929,930],{},"Log level (info, warn, error, debug)",[873,932,933,938,942],{},[891,934,935],{},[439,936,937],{},"service",[891,939,940],{},[439,941,838],{},[891,943,944],{},"Service name",[873,946,947,952,956],{},[891,948,949],{},[439,950,951],{},"environment",[891,953,954],{},[439,955,838],{},[891,957,958],{},"Environment (production, staging, etc.)",[873,960,961,966,970],{},[891,962,963],{},[439,964,965],{},"method",[891,967,968],{},[439,969,838],{},[891,971,972],{},"HTTP method",[873,974,975,980,984],{},[891,976,977],{},[439,978,979],{},"path",[891,981,982],{},[439,983,838],{},[891,985,986],{},"Request path",[873,988,989,994,999],{},[891,990,991],{},[439,992,993],{},"status",[891,995,996],{},[439,997,998],{},"integer",[891,1000,1001],{},"HTTP status code",[873,1003,1004,1009,1013],{},[891,1005,1006],{},[439,1007,1008],{},"duration_ms",[891,1010,1011],{},[439,1012,998],{},[891,1014,1015],{},"Request duration in milliseconds",[873,1017,1018,1023,1027],{},[891,1019,1020],{},[439,1021,1022],{},"request_id",[891,1024,1025],{},[439,1026,838],{},[891,1028,1029],{},"Request correlation ID",[873,1031,1032,1037,1041],{},[891,1033,1034],{},[439,1035,1036],{},"source",[891,1038,1039],{},[439,1040,838],{},[891,1042,1043],{},"Event source (server, client)",[873,1045,1046,1051,1055],{},[891,1047,1048],{},[439,1049,1050],{},"error",[891,1052,1053],{},[439,1054,838],{},[891,1056,1057],{},"Error details (JSON string)",[873,1059,1060,1064,1068],{},[891,1061,1062],{},[439,1063,864],{},[891,1065,1066],{},[439,1067,838],{},[891,1069,1070],{},"All remaining event fields (JSON)",[873,1072,1073,1078,1082],{},[891,1074,1075],{},[439,1076,1077],{},"created_at",[891,1079,1080],{},[439,1081,838],{},[891,1083,1084],{},"Row insertion timestamp",[436,1086,1087,1088,1090,1091,1090,1093,1090,1095,1090,1097,1090,1099,1101],{},"Indexed columns: ",[439,1089,909],{},", ",[439,1092,923],{},[439,1094,937],{},[439,1096,993],{},[439,1098,1022],{},[439,1100,1077],{},".",[852,1103,1105],{"id":1104},"dialect-support","Dialect Support",[436,1107,1108],{},"The schema is automatically registered for your NuxtHub database dialect:",[452,1110,1111,1117,1122],{},[455,1112,1113,1116],{},[503,1114,1115],{},"SQLite"," (default for Cloudflare D1)",[455,1118,1119],{},[503,1120,1121],{},"MySQL",[455,1123,1124],{},[503,1125,1126],{},"PostgreSQL",[436,1128,1129,1130,1133],{},"The correct schema is selected via the ",[439,1131,1132],{},"hub:db:schema:extend"," hook based on your NuxtHub configuration.",[491,1135,1137],{"id":1136},"combining-with-external-adapters","Combining with External Adapters",[436,1139,1140,1142,1143,1145],{},[439,1141,441],{}," doesn't replace external adapters, you can use both. The module registers its own ",[439,1144,809],{}," hook, so any other drain plugins you have will still work:",[538,1147,1150],{"className":656,"code":1148,"filename":1149,"language":658,"meta":544,"style":544},"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",[439,1151,1152,1177,1181,1207,1213,1243],{"__ignoreMap":544},[548,1153,1154,1157,1160,1163,1166,1169,1171,1174],{"class":550,"line":551},[548,1155,1156],{"class":665},"import",[548,1158,1159],{"class":680}," {",[548,1161,1162],{"class":676}," createAxiomDrain",[548,1164,1165],{"class":680}," }",[548,1167,1168],{"class":665}," from",[548,1170,707],{"class":680},[548,1172,1173],{"class":557},"evlog\u002Faxiom",[548,1175,1176],{"class":680},"'\n",[548,1178,1179],{"class":550,"line":684},[548,1180,724],{"emptyLinePlaceholder":723},[548,1182,1183,1185,1187,1190,1192,1194,1198,1201,1205],{"class":550,"line":720},[548,1184,666],{"class":665},[548,1186,669],{"class":665},[548,1188,1189],{"class":672}," defineNitroPlugin",[548,1191,677],{"class":676},[548,1193,677],{"class":680},[548,1195,1197],{"class":1196},"sHdIc","nitroApp",[548,1199,1200],{"class":680},")",[548,1202,1204],{"class":1203},"spNyl"," =>",[548,1206,735],{"class":680},[548,1208,1209],{"class":550,"line":727},[548,1210,1212],{"class":1211},"sHwdD","  \u002F\u002F This runs alongside @evlog\u002Fnuxthub's built-in drain\n",[548,1214,1215,1218,1220,1223,1225,1228,1230,1232,1234,1236,1238,1240],{"class":550,"line":738},[548,1216,1217],{"class":676},"  nitroApp",[548,1219,1101],{"class":680},[548,1221,1222],{"class":676},"hooks",[548,1224,1101],{"class":680},[548,1226,1227],{"class":672},"hook",[548,1229,677],{"class":687},[548,1231,696],{"class":680},[548,1233,809],{"class":557},[548,1235,696],{"class":680},[548,1237,704],{"class":680},[548,1239,1162],{"class":672},[548,1241,1242],{"class":687},"())\n",[548,1244,1245,1247],{"class":550,"line":755},[548,1246,764],{"class":680},[548,1248,767],{"class":676},[491,1250,1252],{"id":1251},"retention","Retention",[436,1254,1255,1257],{},[439,1256,441],{}," automatically deletes old events based on your retention policy. No manual cleanup needed.",[852,1259,170],{"id":1260},"configuration",[436,1262,1263,1264,620],{},"Set the retention period in your ",[439,1265,653],{},[538,1267,1269],{"className":656,"code":1268,"filename":653,"language":658,"meta":544,"style":544},"export default defineNuxtConfig({\n  modules: ['@nuxthub\u002Fcore', '@evlog\u002Fnuxthub'],\n\n  evlog: {\n    retention: '7d', \u002F\u002F default\n  },\n})\n",[439,1270,1271,1283,1309,1313,1321,1338,1342],{"__ignoreMap":544},[548,1272,1273,1275,1277,1279,1281],{"class":550,"line":551},[548,1274,666],{"class":665},[548,1276,669],{"class":665},[548,1278,673],{"class":672},[548,1280,677],{"class":676},[548,1282,681],{"class":680},[548,1284,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307],{"class":550,"line":684},[548,1286,688],{"class":687},[548,1288,620],{"class":680},[548,1290,693],{"class":676},[548,1292,696],{"class":680},[548,1294,699],{"class":557},[548,1296,696],{"class":680},[548,1298,704],{"class":680},[548,1300,707],{"class":680},[548,1302,441],{"class":557},[548,1304,696],{"class":680},[548,1306,714],{"class":676},[548,1308,717],{"class":680},[548,1310,1311],{"class":550,"line":720},[548,1312,724],{"emptyLinePlaceholder":723},[548,1314,1315,1317,1319],{"class":550,"line":727},[548,1316,730],{"class":687},[548,1318,620],{"class":680},[548,1320,735],{"class":680},[548,1322,1323,1325,1327,1329,1331,1333,1335],{"class":550,"line":738},[548,1324,741],{"class":687},[548,1326,620],{"class":680},[548,1328,707],{"class":680},[548,1330,748],{"class":557},[548,1332,696],{"class":680},[548,1334,704],{"class":680},[548,1336,1337],{"class":1211}," \u002F\u002F default\n",[548,1339,1340],{"class":550,"line":755},[548,1341,758],{"class":680},[548,1343,1344,1346],{"class":550,"line":761},[548,1345,764],{"class":680},[548,1347,767],{"class":676},[436,1349,1350],{},"The retention value is a number followed by a unit:",[867,1352,1353,1365],{},[870,1354,1355],{},[873,1356,1357,1360,1362],{},[876,1358,1359],{},"Unit",[876,1361,884],{},[876,1363,1364],{},"Example",[886,1366,1367,1382,1398],{},[873,1368,1369,1374,1377],{},[891,1370,1371],{},[439,1372,1373],{},"d",[891,1375,1376],{},"Days",[891,1378,1379,1381],{},[439,1380,748],{}," = 7 days",[873,1383,1384,1389,1392],{},[891,1385,1386],{},[439,1387,1388],{},"h",[891,1390,1391],{},"Hours",[891,1393,1394,1397],{},[439,1395,1396],{},"24h"," = 24 hours",[873,1399,1400,1405,1408],{},[891,1401,1402],{},[439,1403,1404],{},"m",[891,1406,1407],{},"Minutes",[891,1409,1410,1413],{},[439,1411,1412],{},"60m"," = 60 minutes",[852,1415,1417],{"id":1416},"how-cleanup-works","How Cleanup Works",[436,1419,1420,1421,1424],{},"The module registers a Nitro scheduled task (",[439,1422,1423],{},"evlog:cleanup",") that runs on a cron schedule derived from your retention value. The cron frequency is set to roughly half the retention period:",[867,1426,1427,1438],{},[870,1428,1429],{},[873,1430,1431,1433,1436],{},[876,1432,1252],{},[876,1434,1435],{},"Cron Schedule",[876,1437,884],{},[886,1439,1440,1454,1468,1482],{},[873,1441,1442,1446,1451],{},[891,1443,1444],{},[439,1445,1412],{},[891,1447,1448],{},[439,1449,1450],{},"*\u002F30 * * * *",[891,1452,1453],{},"Every 30 minutes",[873,1455,1456,1460,1465],{},[891,1457,1458],{},[439,1459,1396],{},[891,1461,1462],{},[439,1463,1464],{},"0 *\u002F12 * * *",[891,1466,1467],{},"Every 12 hours",[873,1469,1470,1474,1479],{},[891,1471,1472],{},[439,1473,748],{},[891,1475,1476],{},[439,1477,1478],{},"0 3 * * *",[891,1480,1481],{},"Daily at 3:00 AM",[873,1483,1484,1489,1493],{},[891,1485,1486],{},[439,1487,1488],{},"30d",[891,1490,1491],{},[439,1492,1478],{},[891,1494,1481],{},[436,1496,1497,1498,1500,1501,1503],{},"The cleanup task deletes all rows in ",[439,1499,802],{}," where ",[439,1502,1077],{}," is older than the retention period.",[852,1505,1507],{"id":1506},"manual-cleanup","Manual Cleanup",[436,1509,1510],{},"You can trigger cleanup manually via the API endpoint:",[538,1512,1514],{"className":540,"code":1513,"filename":624,"language":543,"meta":544,"style":544},"curl https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[439,1515,1516],{"__ignoreMap":544},[548,1517,1518,1521],{"class":550,"line":551},[548,1519,1520],{"class":554},"curl",[548,1522,1523],{"class":557}," https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[436,1525,1526,1527,1530],{},"If the ",[439,1528,1529],{},"CRON_SECRET"," environment variable is set, the endpoint requires a Bearer token:",[538,1532,1534],{"className":540,"code":1533,"filename":624,"language":543,"meta":544,"style":544},"curl -H \"Authorization: Bearer your-secret\" \\\n  https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[439,1535,1536,1555],{"__ignoreMap":544},[548,1537,1538,1540,1543,1546,1549,1552],{"class":550,"line":551},[548,1539,1520],{"class":554},[548,1541,1542],{"class":557}," -H",[548,1544,1545],{"class":680}," \"",[548,1547,1548],{"class":557},"Authorization: Bearer your-secret",[548,1550,1551],{"class":680},"\"",[548,1553,1554],{"class":676}," \\\n",[548,1556,1557],{"class":550,"line":684},[548,1558,1559],{"class":557},"  https:\u002F\u002Fyour-app.com\u002Fapi\u002F_cron\u002Fevlog-cleanup\n",[436,1561,1562],{},"This is recommended for production deployments to prevent unauthorized cleanup triggers.",[852,1564,1566],{"id":1565},"vercel-cron","Vercel Cron",[436,1568,1569,1570,1573,1574,1577],{},"When installing the module with ",[439,1571,1572],{},"nuxi module add",", you'll be prompted to create a ",[439,1575,1576],{},"vercel.json"," with the appropriate cron schedule:",[538,1579,1583],{"className":1580,"code":1581,"filename":1576,"language":1582,"meta":544,"style":544},"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",[439,1584,1585,1589,1604,1609,1629,1647,1652,1657],{"__ignoreMap":544},[548,1586,1587],{"class":550,"line":551},[548,1588,681],{"class":680},[548,1590,1591,1594,1597,1599,1601],{"class":550,"line":684},[548,1592,1593],{"class":680},"  \"",[548,1595,1596],{"class":1203},"crons",[548,1598,1551],{"class":680},[548,1600,620],{"class":680},[548,1602,1603],{"class":680}," [\n",[548,1605,1606],{"class":550,"line":720},[548,1607,1608],{"class":680},"    {\n",[548,1610,1611,1614,1616,1618,1620,1622,1625,1627],{"class":550,"line":727},[548,1612,1613],{"class":680},"      \"",[548,1615,979],{"class":554},[548,1617,1551],{"class":680},[548,1619,620],{"class":680},[548,1621,1545],{"class":680},[548,1623,1624],{"class":557},"\u002Fapi\u002F_cron\u002Fevlog-cleanup",[548,1626,1551],{"class":680},[548,1628,717],{"class":680},[548,1630,1631,1633,1636,1638,1640,1642,1644],{"class":550,"line":738},[548,1632,1613],{"class":680},[548,1634,1635],{"class":554},"schedule",[548,1637,1551],{"class":680},[548,1639,620],{"class":680},[548,1641,1545],{"class":680},[548,1643,1478],{"class":557},[548,1645,1646],{"class":680},"\"\n",[548,1648,1649],{"class":550,"line":755},[548,1650,1651],{"class":680},"    }\n",[548,1653,1654],{"class":550,"line":761},[548,1655,1656],{"class":680},"  ]\n",[548,1658,1660],{"class":550,"line":1659},8,[548,1661,1662],{"class":680},"}\n",[436,1664,1665,1666,1668],{},"On Vercel, the ",[439,1667,1529],{}," environment variable is automatically set and validated.",[852,1670,1672],{"id":1671},"cloudflare-other-platforms","Cloudflare & Other Platforms",[436,1674,1675,1676,1679],{},"On Cloudflare Workers and other platforms, the Nitro scheduled task handles cleanup automatically without any additional cron configuration. The task is registered with ",[439,1677,1678],{},"experimental.tasks"," enabled in the Nitro config.",[491,1681,1683],{"id":1682},"next-steps","Next Steps",[452,1685,1686,1691],{},[455,1687,1688,1690],{},[480,1689,327],{"href":332}," - Send logs to external services alongside NuxtHub storage",[455,1692,1693,1695],{},[480,1694,395],{"href":396}," - Batch events for better database performance",[1697,1698,1699],"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":544,"searchDepth":684,"depth":684,"links":1701},[1702,1703,1704,1705,1709,1710,1717],{"id":493,"depth":684,"text":494},{"id":532,"depth":684,"text":533},{"id":646,"depth":684,"text":647},{"id":831,"depth":684,"text":832,"children":1706},[1707,1708],{"id":854,"depth":720,"text":855},{"id":1104,"depth":720,"text":1105},{"id":1136,"depth":684,"text":1137},{"id":1251,"depth":684,"text":1252,"children":1711},[1712,1713,1714,1715,1716],{"id":1260,"depth":720,"text":170},{"id":1416,"depth":720,"text":1417},{"id":1506,"depth":720,"text":1507},{"id":1565,"depth":720,"text":1566},{"id":1671,"depth":720,"text":1672},{"id":1682,"depth":684,"text":1683},"Self-hosted log retention for evlog using NuxtHub database storage. Store, query, and automatically clean up your structured logs with zero external dependencies.","md",[1721,1726],{"label":385,"icon":1722,"to":488,"target":1723,"color":1724,"variant":1725},"i-lucide-external-link","_blank","neutral","subtle",{"label":327,"icon":1727,"to":332,"color":1724,"variant":1725},"i-custom-plug",{},{"title":385,"icon":388},{"title":431,"description":1718},"7IAyh9YhgeYDG6zRJWByEW2QvSef3_48EfOsdchlpRY",[1733,1735],{"title":380,"path":381,"stem":382,"description":1734,"icon":383,"children":-1},"Write wide events to the local file system as NDJSON for local debugging, AI agent integration, and production backup.",{"title":395,"path":396,"stem":397,"description":1736,"icon":398,"children":-1},"Batch events, retry on failure, and protect against buffer overflow with the shared drain pipeline. Supports fan-out to multiple adapters.",1778336625474]