ELK 初体验

想把log统一管理起来,第一个想到的就是ELK了。
先下载解压缩filebeat

curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.7.2-linux-x86_64.tar.gz
tar xzvf filebeat-6.7.2-linux-x86_64.tar.gz

修改配置文件, 默认的配置文件是filebeat.yml

cd filebeat-6.7.0-darwin-x86_64
vim filebeat.yml

把enabled设置成true才能生效,paths就是指定的log目录

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log

配置es的output

output.elasticsearch:
  hosts: ["<es_url>"]
  username: "elastic"
  password: "<password>"

配置kibana访问地址,如果是https的url开始请加上https://,不然报错找不到地址

setup.kibana:
  host: "<kibana_url>"

开启logstash module,在filebeat目录下执行如下命令

./filebeat modules enable logstash

然后可以在modules.d目录下修改logstash.yml的配置

cd modules.d
vim logstash.yml

启动filebeat

#The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.
#./filebeat setup
./filebeat -e

检测到了log的变化,但是没有写入到ES,根据报错信息大概知道是index找不到,并且ES没有开启自动创建index的功能,解决办法是开启自动创建index的配置,或者根据报错信息手动创建一个(PUT /index_name)

{"type":"index_not_found_exception","reason":"no such index and [action.auto_create_index] contains [-*] which forbids automatic creation of the index","index_uuid":"_na_","index":"filebeat-6.7.2-2019.09.17"}
#在kibana管理界面中点击DevTools,然后通过命令手动创建一个index
PUT /filebeat-6.7.2-2019.09.17
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值