ELK安装和配置,简单演示监控tomcat日志记录

ELK的安装和配置,简单演示监控tomcat日志记录

1.安装,地址
     官网: https://www.elastic.co/
     版本: logstash: 5.2.0  elasticsearch: 5.2.0  kibana: 5.2.0
     环境:windows10
     jdk:jdk8

2.配置
     ----logstash
          1)logstash-5.2.0\bin目录下创建Logstash.conf文件,内容如下:
               
input {
     file {
        path => ["E:/apache-tomcat-7.0.55/logs/localhost_access_log.*.txt"]
        start_position => "beginning"
     }
}

filter {
      date {
         match => [ "timestamp" , "YYYY-MM-dd HH:mm:ss" ]
      }
}

output {
       elasticsearch {
          hosts => ["localhost:9200"]
       }
       stdout {
          codec => rubydebug
       }
}

          运行命令:logstash.bat -f logstash.conf

     ----elasticsearch
          基本不用配置
          运行命令 :elasticsearch.bat
          地址:http://localhost:9200       

     ----kibana
          1)kibana\config目录下,修改kibana.yml文件,打开elasticsearch.url: "http://localhost:9200"
          运行命令:kibana.bat
          地址:http://localhost:5601

3.效果


4.注意事项
     ----需要jdk8
     ----elasticsearch的配置默认是2G,我的电脑配置比较低,如果不改的话,运行会报错,所以修改成512m,运行成功,详见附件1
     ----可以查询elasticsearch的index信息,浏览器输入:http://localhost:9200/_cat/indices?v
     ----kibana运行起来之后,需要先设置index,这里需要elasticsearch中有index,否则无法设置kibana的index。笔者就卡在这里很久,后来才找到原因,原来是logstash.conf中input的file属性中,path的值后缀应该是.txt,但是我写成了.log,导致logstash没有文件可以给elasticsearch,所以elasticsearch中没有index,进而使kibana无法设置index

附件
     附件1:
     修改elasticsearch默认配置,防止出现heap溢出,具体错误:

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

          1)elasticsearch\config目录下,修改jvm.options文件的22,23行,
           由 -Xms2g
               -Xmx2g
          改成-Xms512m
                -Xmx512m
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值