ELK优化之Filebeat部署

目录

1.安装配置Nginx

[2.安装 Filebeat](#2.安装 Filebeat)

[3.设置 filebeat 的主配置文件](#3.设置 filebeat 的主配置文件)

4.修改Logstash配置

5.启动配置

6.kibana验证

主机名 ip地址 主要软件
es01 192.168.9.114 ElasticSearch
es02 192.168.9.115 ElasticSearch
es03 192.168.9.116 ElasticSearch、Kibana
nginx01 192.168.9.113 nginx、Logstash
NA 192.168.9.111 nginx、Filebeat
复制代码
初始化操作,所有服务器操作
systemctl disable --now firewalld
setenforce 0
vim /etc/selinux/config
SELINUX=disabled

1.安装配置Nginx

复制代码
cd /etc/yum.repos.d/
上传nginx.repo文件
yum install -y nginx
systemctl enable --now nginx
cd /usr/share/nginx/html
  #准备测试页面
echo '<h1>this is web page</h1>' > test.html
echo '<h1>this is web2 page</h1>' > test1.html

2.安装 Filebeat

复制代码
上传软件包 filebeat-6.7.2-linux-x86_64.tar.gz 到/opt目录
tar xf filebeat-6.7.2-linux-x86_64.tar.gz
mv filebeat-6.7.2-linux-x86_64 /usr/local/filebeat

3.设置 filebeat 的主配置文件

复制代码
cd /usr/local/filebeat
cp filebeat.yml filebeat.yml.bak
vim filebeat.yml
filebeat.inputs:
- type: log         #指定 log 类型,从日志文件中读取消息
  enabled: true     #24行
  paths:
    - /var/log/nginx/access.log       #28行指定监控的日志文件
    - /var/log/nginx/error.log
  tags: ["filebeat"]		#设置索引标签
  fields:           #46行可以使用 fields 配置选项设置一些参数字段添加到 output 中
    service_name: nginx
    log_from: 192.168.9.111

--------------output-------------------
(全部注释掉)

----------------Logstash output---------------------
output.logstash:    #162行
  hosts: ["192.168.9.113:5044"]      #164行指定 logstash 的 IP 和端口

4.修改Logstash配置

复制代码
cd /etc/logstash/conf.d
vim filebeat.conf
input {
    beats {
        port => "5044"
    }
}

#filter {}

output {
     elasticsearch {
                  hosts => ["192.168.9.114:9200", "192.168.9.115:9200", "192.168.9.116:9200"]
                  index => "nginx-%{+yyyy.MM.dd}"
     }

}


logstash -t -f filebeat.conf  #检查文件


5.启动配置

192.168.9.111

#启动 filebeat
./filebeat -e -c filebeat.yml
#-e:输出到标准输出,禁用syslog/文件输出
#-c:指定配置文件

192.168.9.113

#启动 logstash

logstash -f filebeat.conf

6.kibana验证



相关推荐
明明跟你说过2 天前
Kafka 与 Elasticsearch 的集成应用案例深度解析
大数据·elk·elasticsearch·kafka·big data·bigdata
浓黑的daidai3 天前
day-02
linux·运维·elk
shizhan_cloud5 天前
企业级 ELK 日志分析系统
elk
卧室小白9 天前
ELK+Kafka实战
分布式·elk·kafka
heimeiyingwang11 天前
【架构实战】设计一个日志分析平台(ELK架构)
elk·架构·linq
AI木马人20 天前
16.【ELK日志系统实战】一次线上“定位失败”让我重构日志体系:如何在3分钟内定位AI系统问题?(完整可复现方案)
elk·重构
炸炸鱼.21 天前
ELK 企业级日志分析系统完整部署手册
elk·wpf
m0_7375393725 天前
ELK企业日志分析系统
elk
LSL666_25 天前
快速Spring Cloud+ELK+AOP搭建一个简单的项目
spring·elk·spring cloud
JackSparrow4141 个月前
使用Elasticsearch代替数据库like以加快查询的各种技术方案+实现细节
大数据·clickhouse·elk·elasticsearch·搜索引擎·postgresql·全文检索