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