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