[{"data":1,"prerenderedAt":751},["ShallowReactive",2],{"navigation_docs":3,"-nuxthub-retention":191,"-nuxthub-retention-surround":746},[4,30,65,115,132,146],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","/getting-started","1.getting-started",[9,14,19,24],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","/getting-started/quick-start","1.getting-started/3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","/getting-started/agent-skills","1.getting-started/4.agent-skills","i-lucide-sparkles",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Core Concepts","/core-concepts","2.core-concepts",[35,40,45,50,55,60],{"title":36,"path":37,"stem":38,"icon":39},"Wide Events","/core-concepts/wide-events","2.core-concepts/1.wide-events","i-lucide-layers",{"title":41,"path":42,"stem":43,"icon":44},"Structured Errors","/core-concepts/structured-errors","2.core-concepts/2.structured-errors","i-lucide-shield-alert",{"title":46,"path":47,"stem":48,"icon":49},"Best Practices","/core-concepts/best-practices","2.core-concepts/3.best-practices","i-lucide-shield-check",{"title":51,"path":52,"stem":53,"icon":54},"Typed Fields","/core-concepts/typed-fields","2.core-concepts/4.typed-fields","i-simple-icons-typescript",{"title":56,"path":57,"stem":58,"icon":59},"Sampling","/core-concepts/sampling","2.core-concepts/5.sampling","i-lucide-filter",{"title":61,"path":62,"stem":63,"icon":64},"Client Logging","/core-concepts/client-logging","2.core-concepts/6.client-logging","i-lucide-monitor",{"title":66,"path":67,"stem":68,"children":69,"page":29},"Adapters","/adapters","3.adapters",[70,75,80,85,90,95,100,105,110],{"title":71,"path":72,"stem":73,"icon":74},"Overview","/adapters/overview","3.adapters/1.overview","i-custom-plug",{"title":76,"path":77,"stem":78,"icon":79},"Axiom","/adapters/axiom","3.adapters/2.axiom","i-custom-axiom",{"title":81,"path":82,"stem":83,"icon":84},"OTLP","/adapters/otlp","3.adapters/3.otlp","i-simple-icons-opentelemetry",{"title":86,"path":87,"stem":88,"icon":89},"PostHog","/adapters/posthog","3.adapters/4.posthog","i-simple-icons-posthog",{"title":91,"path":92,"stem":93,"icon":94},"Sentry","/adapters/sentry","3.adapters/5.sentry","i-simple-icons-sentry",{"title":96,"path":97,"stem":98,"icon":99},"Better Stack","/adapters/better-stack","3.adapters/6.better-stack","i-simple-icons-betterstack",{"title":101,"path":102,"stem":103,"icon":104},"Custom Adapters","/adapters/custom","3.adapters/7.custom","i-lucide-code",{"title":106,"path":107,"stem":108,"icon":109},"Pipeline","/adapters/pipeline","3.adapters/8.pipeline","i-lucide-workflow",{"title":111,"path":112,"stem":113,"icon":114},"Browser","/adapters/browser","3.adapters/9.browser","i-lucide-globe",{"title":116,"path":117,"stem":118,"children":119,"page":29},"Enrichers","/enrichers","4.enrichers",[120,123,128],{"title":71,"path":121,"stem":122,"icon":28},"/enrichers/overview","4.enrichers/1.overview",{"title":124,"path":125,"stem":126,"icon":127},"Built-in","/enrichers/built-in","4.enrichers/2.built-in","i-lucide-puzzle",{"title":129,"path":130,"stem":131,"icon":104},"Custom","/enrichers/custom","4.enrichers/3.custom",{"title":133,"path":134,"stem":135,"children":136,"page":29},"NuxtHub","/nuxthub","5.nuxthub",[137,141],{"title":71,"path":138,"stem":139,"icon":140},"/nuxthub/overview","5.nuxthub/1.overview","i-lucide-database",{"title":142,"path":143,"stem":144,"icon":145},"Retention","/nuxthub/retention","5.nuxthub/2.retention","i-lucide-clock",{"title":147,"path":148,"stem":149,"children":150,"page":29},"Examples","/examples","6.examples",[151,156,161,166,171,176,181,186],{"title":152,"path":153,"stem":154,"icon":155},"Next.js","/examples/nextjs","6.examples/1.nextjs","i-simple-icons-nextdotjs",{"title":157,"path":158,"stem":159,"icon":160},"SvelteKit","/examples/sveltekit","6.examples/2.sveltekit","i-simple-icons-svelte",{"title":162,"path":163,"stem":164,"icon":165},"TanStack Start","/examples/tanstack-start","6.examples/3.tanstack-start","i-custom-tanstack",{"title":167,"path":168,"stem":169,"icon":170},"NestJS","/examples/nestjs","6.examples/4.nestjs","i-simple-icons-nestjs",{"title":172,"path":173,"stem":174,"icon":175},"Express","/examples/express","6.examples/5.express","i-simple-icons-express",{"title":177,"path":178,"stem":179,"icon":180},"Hono","/examples/hono","6.examples/6.hono","i-simple-icons-hono",{"title":182,"path":183,"stem":184,"icon":185},"Fastify","/examples/fastify","6.examples/7.fastify","i-simple-icons-fastify",{"title":187,"path":188,"stem":189,"icon":190},"Elysia","/examples/elysia","6.examples/8.elysia","i-custom-elysia",{"id":192,"title":193,"body":194,"description":736,"extension":737,"links":738,"meta":742,"navigation":743,"path":143,"seo":744,"stem":144,"__hash__":745},"docs/5.nuxthub/2.retention.md","Retention & Cleanup",{"type":195,"value":196,"toc":724},"minimark",[197,205,210,217,341,346,349,419,423,430,500,511,515,518,534,538,545,574,577,581,592,679,685,689,696,700,720],[198,199,200,204],"p",{},[201,202,203],"code",{},"@evlog/nuxthub"," automatically deletes old events based on your retention policy. No manual cleanup needed.",[206,207,209],"h2",{"id":208},"configuration","Configuration",[198,211,212,213,216],{},"Set the retention period in your ",[201,214,215],{},"nuxt.config.ts",":",[218,219,224],"pre",{"className":220,"code":221,"filename":215,"language":222,"meta":223,"style":223},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  modules: ['@nuxthub/core', '@evlog/nuxthub'],\n\n  evlog: {\n    retention: '7d', // default\n  },\n})\n","typescript","",[201,225,226,250,287,294,305,326,332],{"__ignoreMap":223},[227,228,231,235,238,242,246],"span",{"class":229,"line":230},"line",1,[227,232,234],{"class":233},"s7zQu","export",[227,236,237],{"class":233}," default",[227,239,241],{"class":240},"s2Zo4"," defineNuxtConfig",[227,243,245],{"class":244},"sTEyZ","(",[227,247,249],{"class":248},"sMK4o","{\n",[227,251,253,257,259,262,265,269,271,274,277,279,281,284],{"class":229,"line":252},2,[227,254,256],{"class":255},"swJcz","  modules",[227,258,216],{"class":248},[227,260,261],{"class":244}," [",[227,263,264],{"class":248},"'",[227,266,268],{"class":267},"sfazB","@nuxthub/core",[227,270,264],{"class":248},[227,272,273],{"class":248},",",[227,275,276],{"class":248}," '",[227,278,203],{"class":267},[227,280,264],{"class":248},[227,282,283],{"class":244},"]",[227,285,286],{"class":248},",\n",[227,288,290],{"class":229,"line":289},3,[227,291,293],{"emptyLinePlaceholder":292},true,"\n",[227,295,297,300,302],{"class":229,"line":296},4,[227,298,299],{"class":255},"  evlog",[227,301,216],{"class":248},[227,303,304],{"class":248}," {\n",[227,306,308,311,313,315,318,320,322],{"class":229,"line":307},5,[227,309,310],{"class":255},"    retention",[227,312,216],{"class":248},[227,314,276],{"class":248},[227,316,317],{"class":267},"7d",[227,319,264],{"class":248},[227,321,273],{"class":248},[227,323,325],{"class":324},"sHwdD"," // default\n",[227,327,329],{"class":229,"line":328},6,[227,330,331],{"class":248},"  },\n",[227,333,335,338],{"class":229,"line":334},7,[227,336,337],{"class":248},"}",[227,339,340],{"class":244},")\n",[342,343,345],"h3",{"id":344},"retention-format","Retention Format",[198,347,348],{},"The retention value is a number followed by a unit:",[350,351,352,368],"table",{},[353,354,355],"thead",{},[356,357,358,362,365],"tr",{},[359,360,361],"th",{},"Unit",[359,363,364],{},"Description",[359,366,367],{},"Example",[369,370,371,387,403],"tbody",{},[356,372,373,379,382],{},[374,375,376],"td",{},[201,377,378],{},"d",[374,380,381],{},"Days",[374,383,384,386],{},[201,385,317],{}," = 7 days",[356,388,389,394,397],{},[374,390,391],{},[201,392,393],{},"h",[374,395,396],{},"Hours",[374,398,399,402],{},[201,400,401],{},"24h"," = 24 hours",[356,404,405,410,413],{},[374,406,407],{},[201,408,409],{},"m",[374,411,412],{},"Minutes",[374,414,415,418],{},[201,416,417],{},"60m"," = 60 minutes",[206,420,422],{"id":421},"how-cleanup-works","How Cleanup Works",[198,424,425,426,429],{},"The module registers a Nitro scheduled task (",[201,427,428],{},"evlog:cleanup",") that runs on a cron schedule derived from your retention value. The cron frequency is set to roughly half the retention period:",[350,431,432,443],{},[353,433,434],{},[356,435,436,438,441],{},[359,437,142],{},[359,439,440],{},"Cron Schedule",[359,442,364],{},[369,444,445,459,473,487],{},[356,446,447,451,456],{},[374,448,449],{},[201,450,417],{},[374,452,453],{},[201,454,455],{},"*/30 * * * *",[374,457,458],{},"Every 30 minutes",[356,460,461,465,470],{},[374,462,463],{},[201,464,401],{},[374,466,467],{},[201,468,469],{},"0 */12 * * *",[374,471,472],{},"Every 12 hours",[356,474,475,479,484],{},[374,476,477],{},[201,478,317],{},[374,480,481],{},[201,482,483],{},"0 3 * * *",[374,485,486],{},"Daily at 3:00 AM",[356,488,489,494,498],{},[374,490,491],{},[201,492,493],{},"30d",[374,495,496],{},[201,497,483],{},[374,499,486],{},[198,501,502,503,506,507,510],{},"The cleanup task deletes all rows in ",[201,504,505],{},"evlog_events"," where ",[201,508,509],{},"created_at"," is older than the retention period.",[206,512,514],{"id":513},"manual-cleanup","Manual Cleanup",[198,516,517],{},"You can trigger cleanup manually via the API endpoint:",[218,519,523],{"className":520,"code":521,"language":522,"meta":223,"style":223},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","curl https://your-app.com/api/_cron/evlog-cleanup\n","bash",[201,524,525],{"__ignoreMap":223},[227,526,527,531],{"class":229,"line":230},[227,528,530],{"class":529},"sBMFI","curl",[227,532,533],{"class":267}," https://your-app.com/api/_cron/evlog-cleanup\n",[342,535,537],{"id":536},"cron-secret-protection","Cron Secret Protection",[198,539,540,541,544],{},"If the ",[201,542,543],{},"CRON_SECRET"," environment variable is set, the endpoint requires a Bearer token:",[218,546,548],{"className":520,"code":547,"language":522,"meta":223,"style":223},"curl -H \"Authorization: Bearer your-secret\" \\\n  https://your-app.com/api/_cron/evlog-cleanup\n",[201,549,550,569],{"__ignoreMap":223},[227,551,552,554,557,560,563,566],{"class":229,"line":230},[227,553,530],{"class":529},[227,555,556],{"class":267}," -H",[227,558,559],{"class":248}," \"",[227,561,562],{"class":267},"Authorization: Bearer your-secret",[227,564,565],{"class":248},"\"",[227,567,568],{"class":244}," \\\n",[227,570,571],{"class":229,"line":252},[227,572,573],{"class":267},"  https://your-app.com/api/_cron/evlog-cleanup\n",[198,575,576],{},"This is recommended for production deployments to prevent unauthorized cleanup triggers.",[206,578,580],{"id":579},"vercel-cron","Vercel Cron",[198,582,583,584,587,588,591],{},"When installing the module with ",[201,585,586],{},"nuxi module add",", you'll be prompted to create a ",[201,589,590],{},"vercel.json"," with the appropriate cron schedule:",[218,593,597],{"className":594,"code":595,"filename":590,"language":596,"meta":223,"style":223},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"crons\": [\n    {\n      \"path\": \"/api/_cron/evlog-cleanup\",\n      \"schedule\": \"0 3 * * *\"\n    }\n  ]\n}\n","json",[201,598,599,603,619,624,645,663,668,673],{"__ignoreMap":223},[227,600,601],{"class":229,"line":230},[227,602,249],{"class":248},[227,604,605,608,612,614,616],{"class":229,"line":252},[227,606,607],{"class":248},"  \"",[227,609,611],{"class":610},"spNyl","crons",[227,613,565],{"class":248},[227,615,216],{"class":248},[227,617,618],{"class":248}," [\n",[227,620,621],{"class":229,"line":289},[227,622,623],{"class":248},"    {\n",[227,625,626,629,632,634,636,638,641,643],{"class":229,"line":296},[227,627,628],{"class":248},"      \"",[227,630,631],{"class":529},"path",[227,633,565],{"class":248},[227,635,216],{"class":248},[227,637,559],{"class":248},[227,639,640],{"class":267},"/api/_cron/evlog-cleanup",[227,642,565],{"class":248},[227,644,286],{"class":248},[227,646,647,649,652,654,656,658,660],{"class":229,"line":307},[227,648,628],{"class":248},[227,650,651],{"class":529},"schedule",[227,653,565],{"class":248},[227,655,216],{"class":248},[227,657,559],{"class":248},[227,659,483],{"class":267},[227,661,662],{"class":248},"\"\n",[227,664,665],{"class":229,"line":328},[227,666,667],{"class":248},"    }\n",[227,669,670],{"class":229,"line":334},[227,671,672],{"class":248},"  ]\n",[227,674,676],{"class":229,"line":675},8,[227,677,678],{"class":248},"}\n",[198,680,681,682,684],{},"On Vercel, the ",[201,683,543],{}," environment variable is automatically set and validated.",[206,686,688],{"id":687},"cloudflare-other-platforms","Cloudflare & Other Platforms",[198,690,691,692,695],{},"On Cloudflare Workers and other platforms, the Nitro scheduled task handles cleanup automatically — no additional cron configuration needed. The task is registered with ",[201,693,694],{},"experimental.tasks"," enabled in the Nitro config.",[206,697,699],{"id":698},"next-steps","Next Steps",[701,702,703,710,715],"ul",{},[704,705,706,709],"li",{},[707,708,71],"a",{"href":138}," — Installation and setup",[704,711,712,714],{},[707,713,66],{"href":72}," — Send logs to external services alongside NuxtHub storage",[704,716,717,719],{},[707,718,106],{"href":107}," — Batch events for better database performance",[721,722,723],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .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 .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":223,"searchDepth":252,"depth":252,"links":725},[726,729,730,733,734,735],{"id":208,"depth":252,"text":209,"children":727},[728],{"id":344,"depth":289,"text":345},{"id":421,"depth":252,"text":422},{"id":513,"depth":252,"text":514,"children":731},[732],{"id":536,"depth":289,"text":537},{"id":579,"depth":252,"text":580},{"id":687,"depth":252,"text":688},{"id":698,"depth":252,"text":699},"Configure how long logs are kept in NuxtHub and how they are automatically cleaned up with scheduled tasks, cron jobs, and retention policies.","md",[739],{"label":71,"icon":140,"to":138,"color":740,"variant":741},"neutral","subtle",{},{"title":142,"icon":145},{"title":193,"description":736},"m9NnqzxN2EUtqJiUYYr1Ce-hmQawujWToPWLCOPAAvI",[747,749],{"title":71,"path":138,"stem":139,"description":748,"icon":140,"children":-1},"Self-hosted log retention for evlog using NuxtHub database storage. Store, query, and automatically clean up your structured logs with zero external dependencies.",{"title":152,"path":153,"stem":154,"description":750,"icon":155,"children":-1},"Practical patterns for evlog with Next.js — enrichers, drain pipeline, tail sampling, route-based services, error handling, and client-side logging.",1772901706499]