kibana 页面作图

一、kibana页面作图(简单)

查看日志,就算改成json格式,kibana收集到之后展示时还是一坨,我们想要用数据作图,必须将其修改为json格式,让索引支持使用日志中的key
1.修改logstash获取Tomcat日志作图
[root@web01 ~]# cat /etc/logstash/conf.d/java_es.conf
input {
  file {
    path => "/usr/local/tomcat/logs/tomcat_access_json.*.log"
    start_position => "end"
  }
}

#将收集的日志处理
filter {
  #转换json格式
  json {
    #转换的字段
    source => "message"
    #转换后移除
    remove_field => [ "message" ]
  }
}

output {
  elasticsearch {
    hosts => ['10.0.0.71:9200']
    index => "tomcat_json_log_%{+YYYY-MM-dd}"
  }
}
2.方法二:
[root@web01 ~]# vim /etc/logstash/conf.d/java_es.conf
input {
  file {
    path => "/usr/local/tomcat/logs/tomcat_access_json.*.log"
    start_position => "end"
    codec => "json"
  }
}

output {
  elasticsearch {
    hosts => ['10.0.0.71:9200']
    index => "tomcat_json_log_%{+YYYY-MM-dd}"
  }
}
3.尝试作图
1.都能收集的数据字段有感叹号时,刷新索引即可,删除重建也行
2.转换为json格式的日志后,将转换的字段删除
posted @ 2020-12-08 11:13  nick_xm  阅读(166)  评论(0编辑  收藏  举报