{"record":{"id":"738e17029afddd45","repo":"apache/skywalking","slug":"record-ttl-should-be-at-least-2-days-current-valu","errorCode":null,"errorMessage":"Record TTL should be at least 2 days, current value is {}","messagePattern":"Record TTL should be at least 2 days, current value is (.+?)","errorType":"exception","errorClass":"ModuleStartException","httpStatus":null,"severity":"critical","filePath":"oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java","lineNumber":396,"sourceCode":"            this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout(),\n                                                               moduleConfig.getGRPCSslTrustedCAPath()\n            );\n        } else {\n            this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout());\n        }\n        this.registerServiceImplementation(RemoteClientManager.class, remoteClientManager);\n\n        // Management\n        this.registerServiceImplementation(\n            UITemplateManagementService.class, new UITemplateManagementService(getManager()));\n\n        if (moduleConfig.getMetricsDataTTL() < 2) {\n            throw new ModuleStartException(\n                \"Metric TTL should be at least 2 days, current value is \" + moduleConfig.getMetricsDataTTL());\n        }\n        setBootingParameter(\"TTL.metrics\", moduleConfig.getMetricsDataTTL());\n        if (moduleConfig.getRecordDataTTL() < 2) {\n            throw new ModuleStartException(\n                \"Record TTL should be at least 2 days, current value is \" + moduleConfig.getRecordDataTTL());\n        }\n        setBootingParameter(\"TTL.record\", moduleConfig.getRecordDataTTL());\n\n        final MetricsStreamProcessor metricsStreamProcessor = MetricsStreamProcessor.getInstance();\n        metricsStreamProcessor.setL1FlushPeriod(moduleConfig.getL1FlushPeriod());\n        metricsStreamProcessor.setStorageSessionTimeout(moduleConfig.getStorageSessionTimeout());\n        RecordStreamProcessor.getInstance().setRecordDataTTL(moduleConfig.getRecordDataTTL());\n        TopNStreamProcessor.getInstance().setTopNWorkerReportCycle(moduleConfig.getTopNReportPeriod());\n        apdexThresholdConfig = new ApdexThresholdConfig(this);\n        ApdexMetrics.setDICT(apdexThresholdConfig);\n        loggingConfigWatcher = new LoggingConfigWatcher(this);\n\n        WatermarkGRPCInterceptor.create();\n        this.watermarkWatcher = new WatermarkWatcher(getManager(),\n                                                     moduleConfig.getMaxHeapMemoryUsagePercent(),\n                                                     moduleConfig.getMaxDirectMemoryUsage());\n    }","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java#L378-L414","documentation":"ModuleStartException thrown by CoreModuleProvider.start() when core.record-data-ttl (records = traces/logs/topN records) is below 2 days. Record storage and the TopN/trace query paths assume at least a 2-day window; the provider aborts startup with the offending value in the message. Checked immediately after the metrics TTL guard and before RecordStreamProcessor.setRecordDataTTL(...) is applied.","triggerScenarios":"Setting core.record-data-ttl: 0 or 1 in application.yml, or an env substitution resolving below 2. getRecordDataTTL() < 2 throws.","commonSituations":"Same as metrics TTL: shortening retention on resource-constrained environments, dropping the key from a trimmed config so a low default applies, or assuming the unit is hours/minutes instead of days.","solutions":["Set core.record-data-ttl to at least 2 days (shipped default is 7; often set larger than metrics TTL)","Keep record-data-ttl >= metrics-data-ttl for consistent query behavior","Confirm env-var substitution yields a number >= 2 and restart OAP"],"exampleFix":"# before\ncore:\n  record-data-ttl: 1\n\n# after\ncore:\n  record-data-ttl: 7","handlingStrategy":"validation","validationCode":"int ttl = Integer.parseInt(System.getenv().getOrDefault(\"SW_CORE_RECORD_DATA_TTL\", \"7\"));\nif (ttl < 2) {\n    throw new IllegalStateException(\"core.record-data-ttl must be >= 2 days, got \" + ttl);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce record-data-ttl >= metrics-data-ttl in the same lint rule","Keep the full core: block from the shipped config as the base and override values rather than rewriting the block","Include both TTL keys in environment templates so they cannot be dropped silently"],"tags":["configuration","ttl","storage","startup","oap-server"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}