-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rollover strategy of log4j2 in nacos 1.4.x will cause unlimited log files #11132
Labels
Comments
@i will solve it@ |
@KomachiSion 请问一下1.4.x版本,我应该怎么提交合并申请?fork项目是2.3的版本,已经配置了删除策略了。不知道1.4.x的版本问题怎么去弄。 |
<Configuration status="WARN">
<Properties>
<Property name="userHome" value="${sys:user.home}"/>
<Property name="logPath" value="${sys:JM.LOG.PATH:-${userHome}}"/>
<Property name="logRetainSize" value="${sys:JM.LOG.RETAIN.FILE.SIZE:-1GB}"/>
<Property name="logRetainCount" value="${sys:JM.LOG.RETAIN.FILE.COUNT:-100}"/>
</Properties>
<Appenders>
<RollingFile name="CONFIG_LOG_FILE" fileName="${logPath}/nacos/config.log"
filePattern="${logPath}/nacos/config.log.%d{yyyy-MM-dd}.%i">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="${sys:JM.LOG.FILE.SIZE:-10MB}"/>
</Policies>
<DefaultRolloverStrategy max="${sys:JM.LOG.RETAIN.COUNT:-7}">
<Delete basePath="${logPath}/nacos" maxDepth="1" testMode="${sys:JM.LOG.RETAIN.DURATION.OFF:-true}">
<IfFileName glob="config.log.*.*" />
<IfLastModified age="${sys:JM.LOG.RETAIN.DURATION:-P30D}" >
<IfAny>
<IfAccumulatedFileSize exceeds="${logRetainSize}" />
<IfAccumulatedFileCount exceeds="${logRetainCount}" />
</IfAny>
</IfLastModified>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<Async name="ASYNC_CONFIG" bufferSize="1024" blocking="false">
<AppenderRef ref="CONFIG_LOG_FILE"/>
</Async>
<RollingFile name="NAMING_LOG_FILE" fileName="${logPath}/nacos/naming.log"
filePattern="${logPath}/nacos/naming.log.%d{yyyy-MM-dd}.%i">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="${sys:JM.LOG.FILE.SIZE:-10MB}"/>
</Policies>
<DefaultRolloverStrategy max="${sys:JM.LOG.RETAIN.COUNT:-7}">
<Delete basePath="${logPath}/nacos" maxDepth="1" testMode="${sys:JM.LOG.RETAIN.DURATION.OFF:-true}">
<IfFileName glob="naming.log.*.*" />
<IfLastModified age="${sys:JM.LOG.RETAIN.DURATION:-P30D}" >
<IfAny>
<IfAccumulatedFileSize exceeds="${logRetainSize}" />
<IfAccumulatedFileCount exceeds="${logRetainCount}" />
</IfAny>
</IfLastModified>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<Async name="ASYNC_NAMING" bufferSize="1024" blocking="false">
<AppenderRef ref="NAMING_LOG_FILE"/>
</Async>
</Appenders>
<Loggers>
<Logger name="com.alibaba.nacos.client" level="${sys:com.alibaba.nacos.config.log.level:-info}"
additivity="false">
<AppenderRef ref="CONFIG_LOG_FILE"/>
</Logger>
<Logger name="com.alibaba.nacos.client.config" level="${sys:com.alibaba.nacos.config.log.level:-info}"
additivity="false">
<AppenderRef ref="CONFIG_LOG_FILE"/>
</Logger>
<Logger name="com.alibaba.nacos.client.naming" level="${sys:com.alibaba.nacos.naming.log.level:-info}"
additivity="false">
<AppenderRef ref="NAMING_LOG_FILE"/>
</Logger>
<Root level="INFO">
<AppenderRef ref="CONFIG_LOG_FILE"/>
</Root>
</Loggers>
</Configuration> 这是我修改后的完整配置,新增了删除策略,默认删除30天以上的日志,但是保留最近的1GB或100个日志文件。请问这个配置策略是否可以?(查看nacos 最新的日志配置,默认保留时间是180天,日志可能会达到10G+,个人感觉使用方更多关注的是自己的业务服务日志,很少关注nacos这边的日志,感觉10G+占用磁盘空间有点多了。) |
v1.x-develop branch |
保持和2.x一致的策略即可。 |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
according to log4j2#DefaultRolloverStrategy
nacos strategy as follows:
this strategy means, the number of log files generated per day is limited, but the number of days is unlimited.
nacos client can also generate log files in every day.
Expected behavior
max days limit strategy should be added
The text was updated successfully, but these errors were encountered: