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