前言
在网上找到资料是基于6.2.4的版本,所以我也就用6.2.4的版本试一试,反正我的目的只是做一个了解,然后会用就可以了
下载
官网链接 : https://www.elastic.co/cn/downloads/
以elasticsearch为例找到历史版本:
下载完下图中的几个文件并解压就可以了:
安装 配置
filebeat
1.配置 filebeat.yml
设置为true ,默认是false
配置日志文件位置,支持通配符
配置输入对象为logstash,默认是es
2. 启动logstash
进入到 filebeat的解压目录,执行一下命令
# -e: error 把错误日志 输出到控制台
# -c filebeat.yml: 指定配置文件 filebeat.yml 的路径
# -d "publish": debug模式启动,把publish相关的日志都在控制台输出,
filebeat.exe -e -c filebeat.yml -d "publish"
logstash
# 启动logstash 并指定配置文件
logstash -f ..\config\hello.conf
#测试配置文件是否有语法错误
logstash -f ..\config\hello.conf --config.test_and_exit
#当配置文件修改时,自动重启
logstash -f ..\config\hello.conf --config.reload.automatic
hello.conf 文件
# 通过beat 输入
input{
beats {
port => 5044
}
}
# 配置日志文件解析规则
filter{
#83.149.9.216 - - [04/Jan/2015:05:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/redis.png HTTP/1.1" 200 25230 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
grok {
match => { "message" => "%{IP:client} .* \[%{DATA:timestamp}\] \"%{WORD:
verb} %{URIPATHPARAM:request} .*\/%{GREEDYDATA:httpversion}\" %{NUMBER:
response} %{NUMBER:duration:int} \"%{DATA:referrer}\" \"%{DATA:agent}\"" }
}
#04/Jan/2015:05:13:45 +0000
date{
match=> [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
remove_field => [stimestamp]
}
}
# 输出到 elasticsearch
output{
elasticsearch {
hosts => "http://localhost:9200"
index => "logstash-hello2"
}
stdout{}
}
elasticsearch
# 进入到bin目录启动 elasticsearch
elasticsearch
# 查看es的信息
curl localhost:9200
kibana
# 进入到bin目录
kibana.bat
访问 kibana
http://localhost:5601
配置一下 index
ok 完工