Filebeat 安裝參考 http://blog.csdn.net/kk185800961/article/details/54579376
elasticsearch 安裝參考 http://blog.csdn.net/kk185800961/article/details/54175291
kibana 安裝參考 http://blog.csdn.net/kk185800961/article/details/54232097
logstash 安裝參考 http://blog.csdn.net/kk185800961/article/details/54430493
我這裡用的是 5.6.2 版本,國内下載下傳很慢
這裡是我的百度盤分享 Filebeat + logstash + elasticsearch + kibana
連結:http://pan.baidu.com/s/1i5rHXvZ 密碼:lisn
使用filebeat,springboot 項目不再需要內建 logstash-logback-encoder ,輸出到logstash,再轉換為json
關于elasticsearch 安裝 需要注意 下面一段操作是需要root權限的
# vi /etc/security/limits.conf
elsearch soft nofile 65536
elsearch hard nofile 65536
elsearch soft nproc 2048
elsearch hard nproc 2048
# vi /etc/sysctl.conf
vm.max_map_count=262144
# sysctl -p
filebeat配置輸出到logstash
[root@192 filebeat]# vi filebeat.yml
- input_type: log
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /usr/local/log/*.log #可以配置多個路徑
注釋
#output.elasticsearch:
# Array of hosts to connect to.
#hosts: ["localhost:9200"]
# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"
解開注釋:
output.logstash:
# The Logstash hosts
hosts: ["192.168.1.10:5044"]
index: "filebeat" #索引根名稱
建立logstash.conf,啟動logstash -f logstash.conf
input{
beats {
port => 5044
codec => json # 直接将filebeat儲存在message中的json字串解析出來
}
}
filter {
mutate {
remove_field => ["tags", "beat"]
#删除filebeat自動添加的字段
}
}
output {
elasticsearch {
hosts => ["192.168.1.10:9200"]
index => "logstash" #用這個在kibana頁面上建立索引
}
stdout {
codec => rubydebug
}
}
把mysqld.log放入/usr/local/log/ 測試用.