一、简介
本文介绍了如何快速开始收集日志。您将学习如何:
- 在要监视的每个系统上安装Filebeat
- 指定日志文件的位置
- 将日志数据解析为字段并将其发送到Elasticsearch
- 可视化Kibana中的日志数据
二、开始安装
-
导入秘钥
#rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
-
创建
elastic.repo
文件#vim /etc/yum.repos.d/elastic.repo
[elastic-7.x] name=Elastic repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
-
yum安装
#yum install -y filebeat
2.1 配置filebeat
需要连接到Elasticsearch和Kibana来设置Filebeat。在中设置连接信息
filebeat.yml
。
#vim /etc/filebeat/filebeat.yml
filebeat.inputs: - type: log paths: - /var/log/logstash.log output.logstash: hosts: ["192.168.152.11:5044"]
2.2 启动服务
#/usr/share/filebeat/bin/filebeat -e -c /etc/filebeat/filebeat.yml -d "publish"
正文完