zoukankan      html  css  js  c++  java
  • ES Log4J配置信息

    # 配置RollingFileappender
    appender.rolling.type = RollingFile 
    appender.rolling.name = rolling
    # 日志名称 /var/log/elasticsearch/production.log
    appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log 
    appender.rolling.layout.type = PatternLayout
    appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
    # 滚动日志到/var/log/elasticsearch/production-yyyy-MM-dd-i.log; 日志将被压缩在每个滚动,i并将增加
    appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz 
    appender.rolling.policies.type = Policies
    # 使用基于时间的滚动策略
    appender.rolling.policies.time.type = TimeBasedTriggeringPolicy 
    # 每天滚动日志
    appender.rolling.policies.time.interval = 1 
    # 在日边界上对齐滚动(而不是每24小时滚动一次)
    appender.rolling.policies.time.modulate = true 
    # 使用基于文件大小的滚动策略,比如文件到了100M
    appender.rolling.policies.size.type = SizeBasedTriggeringPolicy 
    # 文件大小在256 MB之后滚动日志
    appender.rolling.policies.size.size = 256MB 
    appender.rolling.strategy.type = DefaultRolloverStrategy
    appender.rolling.strategy.fileIndex = nomax
    # 滚动日志时使用删除操作
    appender.rolling.strategy.action.type = Delete 
    appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path}
    # 只删除匹配文件模式的日志
    appender.rolling.strategy.action.condition.type = IfFileName 
    # 模式是只删除主日志
    appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-* 
    # 只有当我们累积了太多的压缩日志时才删除
    appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize 
    # 压缩日志上的大小条件是2 GB
    appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB 
    

      

    如果要在指定的时间段内保留日志文件,则可以使用带有删除操作的滚动策略。

    # 配置 DefaultRolloverStrategy
    appender.rolling.strategy.type = DefaultRolloverStrategy 
    # 配置Delete处理滚动的动作
    appender.rolling.strategy.action.type = Delete 
    # Elasticsearch日志的基本路径
    appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path} 
    # 处理滚动时应用的条件
    appender.rolling.strategy.action.condition.type = IfFileName 
    # 从与glob匹配的基本路径中删除文件 ${sys:es.logs.cluster_name}-*; 这是日志文件滚动到的glob; 只需要删除滚动的Elasticsearch日志,而不是删除弃用和慢日志
    appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-* 
    # 嵌套的条件适用于与glob匹配的文件
    appender.rolling.strategy.action.condition.nested_condition.type = IfLastModified 
    # 保留七天的日志
    appender.rolling.strategy.action.condition.nested_condition.age = 7D 
    

      

    原文链接:https://blog.csdn.net/qq_21383435/article/details/79295329

  • 相关阅读:
    Session、Cookie、Application、ViewState和Cache 这四者的区别
    用C#构造HighChart类库,把数据转换成JSON第二阶段完成50%API,已经能满足项目要求了
    HttpHandler 在SharePoint 2010中的应用
    SharePoint 2010 在多台前端环境 还原 网站集 问题解析
    SharePoint 2010 PowerShell 系列 之 文档管理 高级应用和企业案例(文档迁移)
    设计模式策略模式
    CentOS7 安装Hbase集群
    CentOS7 安装zookeeper
    CentOS7 安装Hadoop集群环境
    Django Rest Framework关闭CSRF验证
  • 原文地址:https://www.cnblogs.com/woniu4/p/9920874.html
Copyright © 2011-2022 走看看