docker+kibana+filebeat的安裝


安裝filebeat服務(在需要收集日志的主機安裝filebeat)

下載和安裝key文件

rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch

創建yum源文件(版本要和elasticsearch和kibana一樣

[root@localhost ~]# vim /etc/yum.repos.d/elk-elasticsearch.repo
[elastic-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

 

開始安裝並啟動服務

yum install filebeat
systemctl start filebeat
systemctl status filebeat

 

 

收集日志

[root@localhost ~]# grep "^\s*[^# \t].*$" /etc/filebeat/filebeat.yml 
filebeat.prospectors:
- type: log
  enabled: true
  paths:
    - /var/xxx/*.log
    - /var/xxx/*.out
  multiline.pattern: ^\[   //multiline這三行是讀取多行日志的,不把注釋去掉,在kibana查看日志格式會很亂
  multiline.negate: true   //false改為true
  multiline.match: after
setup.kibana:
  host: "192.168.1.191:5601"
output.elasticsearch:
  hosts: ["192.168.1.191:9200"]

 

重啟服務

systemctl restart filebeat

 

 

安裝Kibana

安裝

docker pull docker.io/kibana:5.6.12
docker run -it -d -e ELASTICSEARCH_URL=http://192.168.1.191:9200 --name kibana --restart=always -p 5601:5601 kibana:5.6.12

 新版本的 kibana 官方已經支持中文,配置文件中配置即可

grep -Ev "^#|^$" /etc/kibana/kibana.yml

server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
pid.file: /tmp/kibana.pid
i18n.locale: "zh-CN"

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM