ELK之使用filebeat收集系统数据及其他程序并生成可视化图表
当您要面对成百上千、甚至成千上万的服务器、虚拟机和容器生成的日志时,请告别 SSH 吧。Filebeat 将为您提供一种轻量型方法,用于转发和汇总日志与文件,让简单的事情不再繁杂。
1,安装filebeat
rpm -ivh /nas/nas/softs/elk/6.5.4/filebeat-6.5.4-x86_64.rpm
查看模块
[root@prd-elk-kafka-01 ~]# filebeat modules list
Enabled:
kafka
system Disabled:
apache2
auditd
elasticsearch
haproxy
icinga
iis
kibana
logstash
mongodb
mysql
nginx
osquery
postgresql
redis
suricata
traefik
如需要启用某个模块使用命令
filebeat modules enable system
修改配置文件把filebeat输出至elasticsearch和kibana
/etc/filebeat/filebeat.yml
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
output.elasticsearch:
hosts: ["172.16.90.24:9200"]
# username: "admin"
# password: "admin"
setup.kibana:
host: "172.16.90.24:5601"
processors:
- add_host_metadata:
- add_cloud_metadata:
# - drop_fields:
# fields: ["beat", "input", "source", "offset", "prospector","host"]
模块路径为/etc/filebeat/modules.d/
2,设置系统模块system
启用系统模块
/etc/filebeat/filebeat.yml
编辑系统模块配置文件,这里使用默认
/etc/filebeat/modules.d/system.yml
- module: system
# Syslog
syslog:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths: # Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false # Authorization logs
auth:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths: # Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false
系统模块每一台主机都需要安装,启用后查看kibana


3,设置nginx模块
启动nginx模块
filebeat modules enable nginx
修改配置文档
/etc/filebeat/modules.d/nginx.yml
输入access日志及error日志路径
- module: nginx
# Access logs
access:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths:
- "/opt/log/wwwaccess.log"
- "/opt/log/workaccess.log"
- "/opt/log/datavaccess.log" # Error logs
error:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths:
- "/opt/log/wwwerror.log"
- "/opt/log/workerror.log"
- "/opt/log/dataverror.log"
kibana查看



要显示客户端城市及浏览器信息需要安装elasticsearch插件
bin/elasticsearch-plugin install ingest-geoip
bin/elasticsearch-plugin install ingest-user-agent
4,设置redis模块
启用redis模块
filebeat modules enable redis
修改redis配置文件
/etc/filebeat/modules.d/redis.yml
- module: redis
# Main logs
log:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: ["/nas/nas/logs/redis/redis-server.log"] # Slow logs, retrieved via the Redis API (SLOWLOG)
slowlog:
enabled: true # The Redis hosts to connect to.
var.hosts: ["localhost:6379"] # Optional, the password to use when connecting to Redis.
var.password: "password"
kibana页面查看


5,设置kafka模块
启用kafka模块
filebeat modules enable kafka
修改配置文件
/etc/filebeat/modules.d/kafka.yml
- module: kafka
# All logs
log:
enabled: true # Set custom paths for Kafka. If left empty,
# Filebeat will look under /opt.
#var.kafka_home: # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths:
- "/usr/local/kafka/logs/controller.log*"
- "/usr/local/kafka/logs/server.log*"
- "/usr/local/kafka/logs/state-change.log*"
- "/usr/local/kafka/logs/kafka-*.log*"
# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false
kibana查看


6,设置MySQL模块
开启mysql模块
filebeat modules enable mysql
修改配置文件
/etc/filebeat/modules.d/mysql.yml
输入日志及慢查询日志文件路径
- module: mysql
# Error logs
error:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: ["/var/log/mysql3306.log"] # Slow logs
slowlog:
enabled: true # Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: ["/nas/nas/logs/mysql/slow3306.log"]
kibana查看


更多模块查看官方文档https://www.elastic.co/guide/en/beats/filebeat/6.5/filebeat-modules.html
ELK之使用filebeat收集系统数据及其他程序并生成可视化图表的更多相关文章
- ELK之使用metricbeat收集系统数据及其他程序并生成可视化图表
将 Metricbeat 部署到您所有的 Linux.Windows 和 Mac 主机,并将它连接到 Elasticsearch 就大功告成啦:您可以获取系统级的 CPU 使用率.内存.文件系统.磁盘 ...
- ELK+kafka构建日志收集系统
ELK+kafka构建日志收集系统 原文 http://lx.wxqrcode.com/index.php/post/101.html 背景: 最近线上上了ELK,但是只用了一台Redis在 ...
- Kubernetes部署ELK并使用Filebeat收集容器日志
本文的试验环境为CentOS 7.3,Kubernetes集群为1.11.2,安装步骤参见kubeadm安装kubernetes V1.11.1 集群 1. 环境准备 Elasticsearch运行时 ...
- ELK之使用filebeat收集java运行日志
安装filebeat修改配置文件/etc/filebeat/filebeat.yml filebeat.prospectors: - type: log enabled: true #日志路径 pat ...
- filebeat收集日志到elsticsearch中并使用ingest node的pipeline处理
filebeat收集日志到elsticsearch中 一.需求 二.实现 1.filebeat.yml 配置文件的编写 2.创建自定义的索引模板 3.加密连接到es用户的密码 1.创建keystore ...
- nGrinder对监控机器收集自定义数据及源码分析
转载:https://blog.csdn.net/neven7/article/details/50782451 0.背景 性能测试工具nGrinder支持在无需修改源码的情况下,对目标服务器收集自定 ...
- [Xcode 实际操作]七、文件与数据-(1)获取程序沙箱结构中常用的几个目录
目录:[Swift]Xcode实际操作 本文将演示如何获取程序沙箱结构中,常见的几个目录. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit ...
- 使用VS2017 编写Linux系统上的Opencv程序
背景 之前写图像算法的程序都是在window10下使用VS编写,VS这个IDE结合“ImageWatch.vsix“插件,用于调试opencv相关的图像算法程序十分方便.后因项目需要,需将相关程序移植 ...
- Kafka+Zookeeper+Filebeat+ELK 搭建日志收集系统
ELK ELK目前主流的一种日志系统,过多的就不多介绍了 Filebeat收集日志,将收集的日志输出到kafka,避免网络问题丢失信息 kafka接收到日志消息后直接消费到Logstash Logst ...
随机推荐
- Win10系统的SurfacePro4的触摸笔如何使用
初次使用需要配对,微软的触摸笔是蓝牙配对的,打开平板的蓝牙,长按触摸笔后面的按钮,触摸笔会闪烁小灯,平板会提示配对准备已就绪 点击配对之后,提示已连接 可以按下触摸笔后面的按钮,一键打开One ...
- 每天一个linux命令:chgrp
1.命令简介 chgrp(Change group) 用来将每个指定文件的所属组设置为指定值.如果使用 --reference,则将每个文件的所属组设置为与指定参考文件相同. 2.用法 ...
- Docker Mysql数据库双主同步配置方法
一.背景 可先查看第一篇<Docker Mysql数据库主从同步配置方法>介绍 二.具体操作 1.创建目录(~/test/mysql_test1): --mysql --mone --da ...
- NoSuchMethodError: The getter 'inputs' was called on null.
I get this message : You have hit a bug in build_runner Please file an issue with reproduction steps ...
- 生成网上下载的EF项目对应的数据库
生成网上下载的EF项目对应的数据库 网上下载的用EF做的小项目,结果没有配有数据库的,用VS打开来看了一下,看到Migrations文件夹,应该可以用EF命令来生成这个数据库了 打开appsettin ...
- Android CPU类型及预定义的宏
[时间:2019-02] [状态:Open] [关键词:android,cpu, armeabi, armeabi-v7a, arm64-v8a, 32位,64位,c/c++] 本文主要总结下前段时间 ...
- git 中merge的用法
git merge –no-ff 可以保存你之前的分支历史.能够更好的查看 merge历史,以及branch 状态. git merge 则不会显示 feature,只保留单条分支记录.
- Oracle 如何对中文字段进行排序
Oracle 如何对中文字段进行排序 oracle中drop.delete和truncate的区别 oracle里的执行计划-查看
- Android打开doc、xlsx、ppt等office文档解决方案
妹子我写代码很辛苦/(ㄒoㄒ)/~~ ,转载请标明出处哦~http://blog.csdn.net/u011791526/article/details/73088768 1.Android端有什么控 ...
- 股票配资源码系统APP股票配资系统PC版配资系统
股票配资策略系统一套,pc+wap双端,封装app! 需要服务器环境: LNMP/LAMP ,域名,短信服务,IOS端APP需要企业签名发布,或者有金融行业资质到APPstore发布 产品介绍: 全套 ...