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