• Filebeat+Kafka+ELK


    ELK+Kafka+zookeeper+Filebeat(nginx)

    在这里插入图片描述

    ------------------------------ ELK+Kafka+zookeeper+Filebeat(nginx) --------------------------------
    
    192.168.11.150	es1 	Elasticsearch+Elasticsearch-head+phantomjs+node
    192.168.11.151 	es2 	Elasticsearch+Elasticsearch-head+phantomjs+node
    192.168.11.152 	logstash+kibana
    192.168.11.144 	zookeeper+kafka
    192.168.11.145	zookeeper+kafka
    192.168.11.146	zookeeper+kafka
    192.168.11.137 	filebeat+nginx
    
    192.168.11.137    filebeat+nginx
    
    [root@test2 ~]# cd /opt/
    [root@test2 ~]# tar -xf filebeat-6.7.2-linux-x86_64.tar.gz
    [root@test2 ~]# mv filebeat-6.7.2-linux-x86_64 filebeat
    [root@test2 ~]# cd filebeat/
    [root@test2 filebeat]# pwd
    /opt/filebeat
    [root@test2 filebeat]# vim filebeat.yml 
    filebeat.prospectors:
    - type: log
      enabled: true
      paths:
        - /var/log/nginx/access_log
      tags: ["access"]
      
    - type: log
      enabled: true
      paths:
        - /var/log/nginx/error_log
      tags: ["error"]
    #添加输出到 Kafka 的配置
    161行
    output.kafka:
      enabled: true
      hosts: ["192.168.11.144:9092","192.168.11.145:9092","192.168.11.146:9092"]    #指定 Kafka 集群配置
      topic: "nginx"    #指定 Kafka 的 topic
      
    #启动 filebeat
    nohup ./filebeat -e -c filebeat.yml> filebeat.out &
    
    192.168.11.152  
    [root@apache-elk3 ~]# cd /etc/logstash/conf.d/
    [root@apache-elk3 conf.d]# vim kafka.conf 
    input {
        kafka {
            bootstrap_servers => "192.168.11.144:9092","192.168.11.145:9092","192.168.11.146:9092"  
    		#kafka集群地址
            topics  => "nginx"     
    		#拉取的kafka的指定topic
            type => "nginx_kafka"  
    		#指定 type 字段
            codec => "json"        
    		#解析json格式的日志数据
    		auto_offset_reset => "latest"  
    		#拉取最近数据,earliest为从头开始拉取
    		decorate_events => true   
    		#传递给elasticsearch的数据额外增加kafka的属性数据
        }
    }
    
    output {
      if "access" in [tags] {
        elasticsearch {
          hosts => ["192.168.11.150:9200","192.168.11.151:9200"]
          index => "nginx_access-%{+YYYY.MM.dd}"
        }
      }
      
      if "error" in [tags] {
        elasticsearch {
          hosts => ["192.168.11.150:9200","192.168.11.151:9200"]
          index => "nginx_error-%{+YYYY.MM.dd}"
         }
       }
    }
    
    #启动 logstash
    logstash -f kafka.conf --path.data /opt/test9 &
    
    4.浏览器访问 http://192.168.39.60:5601 登录 Kibana,
    单击“Create Index Pattern”按钮添加索引“filebeat_test-*”,单击 “create” 按钮创建,
    单击 “Discover” 按钮可查看图表信息及日志信息。
    

    x Pattern”按钮添加索引“filebeat_test-*”,单击 “create” 按钮创建,
    单击 “Discover” 按钮可查看图表信息及日志信息。

    
    
    
    
    
    
  • 相关阅读:
    JavaScript常用事件
    Adaptive AUTOSAR Technology Sharing
    推荐系统[八]算法实践总结V2:排序学习框架(特征提取标签获取方式)以及京东推荐算法精排技术实战
    kubernetes的服务暴露Service的三种常用类型
    如何清理mac磁盘空间?该删不该删的你都知道了吗
    【OpenCV 例程200篇】206. Photoshop 色阶调整算法
    Jmeter 逻辑控制之IF条件控制器
    【C语言从青铜到王者】第五篇·数据在内存中的存储
    antv G6在vue项目中的实践总结
    关于js_document对象中的获取元素,创建元素的方法
  • 原文地址:https://blog.csdn.net/qq_52448810/article/details/140998340