zoukankan      html  css  js  c++  java
  • ELK之filebeat收集多类型日志

    1.IP规划

    10.0.0.33:filebeat+tomcat,filebeat收集系统日志、tomcat日志发送到logstash

    10.0.0.32:logstash,将日志写入reids(input、output)

    10.0.0.31:redis,大量缓存数据

    10.0.0.30:logstash,从redis取出数据写入es(input、output)

    10.0.0.29:es+kibana,es接收传来的数据写入磁盘,等待kibana来取

    a.10.0.0.33:filebeat输出到logstash

    vim /etc/filebeat/filebeat.yml
    filebeat.prospectors:
    - input_type: log
      paths:
        - /var/log/*.log
        - /var/log/messages
      exclude_lines: ['^DBG',"^$"]
      document_type: filebeat-systemlog-0033
    - input_type: log
      paths:
        - /usr/local/tomcat/logs/tomcat_access_log.*.log
      exclude_lines: ['^DBG',"^$"]
      document_type: tomcat-accesslog-0033
    output.logstash:
      hosts: ["10.0.0.32:5044"]
      enabled: true
      worker: 2
      compression_level: 3
    
    systemctl restart filebeat
    

    b.10.0.0.32:logstash将日志写入reids(向redis写数据不需要给key加日期)

    vim beats.conf 
    
    input {
      beats {
        port => "5044"
      }
    }
    output {
      if [type] == "filebeat-systemlog-0033" {
        redis {
          data_type => "list"
          host => "10.0.0.31"
          db => "3"
          port => "6379"
          password => "123456"
          key => "filebeat-systemlog-0033"
        }
      }
      if [type] == "tomcat-accesslog-0033" {
        redis {
          data_type => "list"
          host => "10.0.0.31"
          db => "4"
          port => "6379"
          password => "123456"
          key => "tomcat-accesslog-0033"
        }
      }
    }
    
    systemctl restart logstash
    

    c.10.0.0.31:redis不用做什么操作

    d.10.0.0.30:logstash从redis取出数据写入es

    vim redis-es.conf
    input {
      redis {
        data_type => "list"
        host => "10.0.0.31"
        db => "3"
        port => "6379"
        key => "filebeat-systemlog-0033"
        password => "123456"
      }
      redis {
        data_type => "list"
        host => "10.0.0.31"
        db => "4"
        port => "6379"
        key => "tomcat-accesslog-0033"
        password => "123456"
      }
    }
    
    output {
      if [type] == "filebeat-systemlog-0033" {
        elasticsearch {
          hosts => ["10.0.0.29:9200"]
          index => "redis31-systemlog-%{+YYYY.MM.dd}"
        }
      }
      if [type] == "tomcat-accesslog-0033" {
        elasticsearch {
          hosts => ["10.0.0.29:9200"]
          index => "tomcat-accesslog-0033-%{+YYYY.MM.dd}"
        }
      }
    }
    systemctl restart logstash
    

    e.10.0.0.29:es+kibana

    es插件页面出现这个日志索引时tomcat-accesslog-0033-xxxx.xx.xx,代表整个流程是通的.

    ELK架构实用演示:http://blog.51cto.com/jinlong/2056717

  • 相关阅读:
    android学习---Gallery画廊视图
    王立平--查看SQLite中的数据信息
    java中CyclicBarrier简单入门使用
    [ExtJS5学习笔记]第三十三节 sencha extjs 5 grid表格导出excel
    使用target打开的iframe 获取src的问题
    读《暗时间》的思考
    hdfs
    编译最新的SQLite 3.8.4.3为一个DLL
    使用Highcharts生成折线图_at last
    CentOS7 安装EFK(elasticsearch、fluent、kibana)进行Docker下日志搜集
  • 原文地址:https://www.cnblogs.com/fawaikuangtu123/p/10360187.html
Copyright © 2011-2022 走看看