zoukankan      html  css  js  c++  java
  • Filebeat简介

    一、filebeat学习

    1.简介

    Filebeat附带预构建的模块,这些模块包含收集、解析、充实和可视化各种日志文件格式数据所需的配置,每个Filebeat模块由一个或多个文件集组成,这些文件集包含摄取节点管道、Elasticsearch模板、Filebeat勘探者配置和Kibana仪表盘。
    
    Filebeat模块很好的入门,它是轻量级单用途的日志收集工具,用于在没有安装java的服务器上专门收集日志,可以将日志转发到logstash、elasticsearch或redis等场景中进行下一步处理。
    
    Filebeat与logstash作用是一样
    Logstash是java写的,需要java环境
    filebeat是go写的,不需要安装java环境,并且非常的轻量
    

    2.安装filebeat

    #上传包
    [root@web01 ~]# rz filebeat-6.6.0-x86_64.rpm
    
    #安装
    [root@web01 ~]# rpm -ivh filebeat-6.6.0-x86_64.rpm
    

    3.配置文件

    [root@web01 ~]# rpm -qc filebeat
    /etc/filebeat/filebeat.yml
    

    二、filebeat收集本地日志到文件

    1.配置

    # filebeat基本格式,将本地日志文件输出到文件
    [root@web01 ~]# vim /etc/filebeat/filebeat.yml
    filebeat.inputs:
    - type: log
      enable: true
      paths:
        - /var/log/messages
    output.file:
      path: "/tmp"
      filename: "filebeat_messages.log"
    

    2.启动

    [root@web01 ~]# systemctl start filebeat.service
    
    #验证
    [root@web01 ~]# ps -ef | grep filebeat
    

    3.测试

    [root@web01 ~]# tail -f /tmp/filebeat_messages.log
    
    #输入内容
    [root@web01 ~]# echo "123" >> /var/log/messages
    

    三、filebeat收集本地日志到ES

    1.配置

    # filebeat基本格式,将本地日志文件输出到es中(严格按照yaml语法格式,如启动后进程突然中断说明语法问题。)
    filebeat.inputs:
    - type: log
      enable: true
      paths:
        - /var/log/nginx/access.log
    
    output.elasticsearch:
      hosts: ["10.0.0.51:9200"]
    

    2.启动

    [root@web01 ~]# systemctl restart filebeat.service
    
    #验证
    [root@web01 ~]# ps -ef | grep filebeat
    

    3.测试

    #访问Nginx
    http://10.0.0.7:8081/
    
    #查看ES页面
    
  • 相关阅读:
    CentOS6设置密码过期时间
    scp
    windows查看进程
    mysql5.7密码问题
    mysql主从切换摘要
    mysql慢日志管理
    Linux学习(一)
    Linux学习(一)
    数据结构与算法(1)-算法时间复杂度
    数据结构与算法(1)-算法时间复杂度
  • 原文地址:https://www.cnblogs.com/tcy1/p/13519339.html
Copyright © 2011-2022 走看看