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