原创作者:运维工程师 谢晋
- Filebeat安装
- Logstash安装
- Kibana安装
- 安装Filebeat软件包
上传Kibana的rpm包并安装
# rpm -ivh filebeat-6.5.4-x86_64.rpm
- 创建Filebeat配置文件
# mv /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.bak
# vim /etc/filebeat/filebeat.yml
filebeat.inputs:
- input_type: log
paths:
- /var/log/nginx/access.log
json.overwrite_keys: true
json.keys_under_root: true
fields:
host: "10.11.11.31"
sublei : "nginx"
output.redis:
hosts: ["10.11.11.32:6379"]
db: 2
timeout: 10
key: "testnginx"
- 启动Filebeat
# systemctl start FilebeatLogstash安装
- 安装Logstash软件包
上传Logstash的rpm包并安装
# rpm -ivh logstash-6.5.4-x86_64.rpm
- 创建Logstash配置文件
# cd /etc/logstash/conf.d
# vim testnginx.conf
input {
redis {
host => "10.11.11.32" #redis地址
port => "6379"
data_type => "list"
db => 2
batch_count => 1
#type => "log"
key => "testnginx"
}
}
filter {
date {
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
}
mutate {
convert => [ "request_time" ,"float"]
convert => [ "upstream_time", "float"]
convert => [ "status", "integer"]
convert => [ "body_size", "integer"]
}
}
output {
#stdout { codec => rubydebug }
elasticsearch {
user => "elk"
password => "Hzgnet@2020"
hosts => ["10.11.11.30:9200"]
index => "testnginx-%{+YYYY.MM.dd}"
template_name => "testnginx"
}
}
- 启动Logstash
# systemctl start logstashKibana安装
- 安装Kibana软件包
上传Kibana的rpm包并安装
# rpm -ivh kibana-6.5.4-x86_64.rpm
- 修改Kibana配置文件
# vim /etc/kibana/kibana.yml server.port: 5601 server.host: "10.11.11.30" #ELK地址 server.name: "node01" elasticsearch.url: "http://10.11.11.30:9200" kibana.index: ".kibana"
- 启动Kibana
# systemctl start kibana
- 测试登录
用浏览器打开Kibana网页,http://IP:5601
- Kibana汉化
下载并解压Kibana中文汉化包
#wget https://mirrors.yangxingzhen.com/kibana/Kibana_Hanization.tar.gz # tar -zxvf Kibana_Hanization.tar.gz
执行汉化
# cd Kibana_Hanization/old/ # python main.py /usr/share/kibana
重启Kibana服务
# systemctl restart kibana
查看效果
ELK+Filebeat+Redis部署应用指导书(四)



