Kubernetes Cloud Native 实践 ( 六 ) 集成ELK日志平台

kyaa111 10月前 ⋅ 242 阅读

全文目录

Kubernetes Cloud Native 实践 ( 一 ) 安装

Kubernetes Cloud Native 实践 ( 二 ) 简单使用

Kubernetes Cloud Native 实践 ( 三 ) NFS/PV/PVC

Kubernetes Cloud Native 实践 ( 四 ) 中间件上云

Kubernetes Cloud Native 实践 ( 五 ) 应用上云

Kubernetes Cloud Native 实践 ( 六 ) 集成ELK日志平台

Kubernetes Cloud Native 实践 ( 七 ) 应用监控

Kubernetes Cloud Native 实践 ( 八 ) CICD集成

Kubernetes Cloud Native 实践 ( 九 ) 运维管理

Kubernetes Cloud Native 实践 ( 十 ) 相关问题

Kubernetes Cloud Native 实践 ( 十一 ) 运行截图

  1. 接之前的搭建过程: https://blog.22xcode.com/post/183
  2. 在主机上修改下logstash的配置即可
input {
  file {
    #标签
    type => "record-web"
    path => "/nfs/app-log-record-web-*/debug.log"
    #开始收集点
    start_position => "beginning"
    #扫描间隔时间,默认是1s,建议5s
    stat_interval => "1"
  }
}

filter {
  dissect {
    mapping => {
      "message" => "[%{date}] [%{application}] [%{ip}] [TID:%{tid}] [%{thread}] [%{level}] [[[[%{info}]]]]"
    }
  }
  multiline {
    pattern => "^\s"
    what => "previous"
  }
  date {
    match => ["date", "ISO8601"]
    timezone => "Asia/Shanghai"
  }
}

output {
  elasticsearch {
    #集群的话,直接添加多个url
    hosts => ["10.11.38.190:9200"]
    user => "elastic"
    password => "elastic"
    index => "logstash-system-debug-record-web-%{+YYYY.MM.dd}"
  }
  #在控制台输出logstash的日志
  stdout { codec=> rubydebug }
}
  1. 重启激活配置