1 、安装elasticsearch:安装教程(某度随意一篇,按照流程操作即可)
2 安装logstash
2.1 解压logstash
2.2 config目录下创建文件http.conf
# 定义日志来源
input {
http {
host => "localhost"
port => 8087
}
}
filter {
# http 过滤非/hello前缀的url, 且请求传入 message为空时 则删除该信息
if ([headers][request_path] !~ '^\/procedure\/exception' or [message] == "") {
drop {}
}
}
output{
elasticsearch {
action => "index"
hosts => "localhost:9200"
}
stdout{codec => rubydebug}
}
# 定义日志来源 input { http { host => "localhost" port => 8087 } } filter { # http 过滤非/hello前缀的url, 且请求传入 message为空时 则删除该信息 if ([headers][request_path] !~ '^\/procedure\/exception' or [message] == "") { drop {} } } output{ elasticsearch { action => "index" hosts => "localhost:9200" } stdout{codec => rubydebug} }
2.3 bin目录下执行:logstash.bat -f ../config/http.conf
此时遇到错误:1、启动logstash报错: 找不到或无法加载主类 Files\Java\jdk1.8.0_172\lib\dt.jar;,解决方法:参考https://blog.csdn.net/DENAN0108/article/details/82590434
2、启动logstash报错:找不到或无法加载主类 Files\Java\jdk1.8.0_161\lib;G:"Program ...\logstash-6.2.2\logstash-core\lib\jars\guava-22.0.jar";:解决办法:将logstash目录去除空格。
2.4 浏览器访问 http://localhost:9600/
3 安装kibana
最简单,本地跑的话用默认配置就好了。
双击bin目录下的kibina.bat