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验证



相关推荐
m0_737539372 天前
ELK企业日志分析系统
elk
LSL666_3 天前
快速Spring Cloud+ELK+AOP搭建一个简单的项目
spring·elk·spring cloud
JackSparrow4145 天前
使用Elasticsearch代替数据库like以加快查询的各种技术方案+实现细节
大数据·clickhouse·elk·elasticsearch·搜索引擎·postgresql·全文检索
工作log6 天前
从零搭建 ELK + Kafka 日志收集系统(Spring Boot + Logback 直连 Kafka)
spring boot·elk·kafka
總鑽風16 天前
搭建Spring Boot + ELK日志平台,实现可视化日志监控
spring boot·elk·macos
七七powerful16 天前
运维养龙虾--使用workbuddy专家模式一句话部署ELK 日志分析平台
elk·workbuddy
人间打气筒(Ada)19 天前
「码动四季·开源同行」go语言:如何使用 ELK 进行日志采集以及统一处理?
开发语言·分布式·elk·go·日志收集·分布式日志系统
艾伦_耶格宇19 天前
【ELK】-1 ELK的简要介绍
elk
尽兴-24 天前
微服务日志采集与分析系统实战:ELK 架构全解析与落地
elk·微服务·架构·kibana·es·logstash·filebeat
泡沫·1 个月前
ELK 企业日志分析系统核心总结
elk