• filebeat分别收集多个类型日志


    一. filebeat分别收集Nginx正常和错误日志

    filebeat配置文件:

    filebeat.inputs:
    - type: log
      enabled: true
      paths:
        - /var/log/nginx/access.log
      json.keys_under_root: true
      json.overwrite_keys: true
      tags: ["access"]
    
    - type: log
      enabled: true
      paths:
        - /var/log/nginx/error.log
      tags: ["error"]
    
    setup.kibana:
       host: "10.0.0.31:5601"
    
    output.elasticsearch:
      hosts: ["10.0.0.31:9200"]
      #index: "nginx-%{[beat.version]}-%{+yyyy.MM}"
      indices:
        - index: "nginx_access-%{[beat.version]}-%{+yyyy.MM}"
          when.contains:
            tags: "access"
        - index: "nginx_error-%{[beat.version]}-%{+yyyy.MM}"
          when.contains:
            tags: "error"
    
    setup.template.name: "nginx"
    setup.template.pattern: "nginx-*"
    setup.template.enabled: false
    setup.template.overwrite: true

     2.filebeat配收集omcat日志

    配置文件

    1 filebeat.inputs:
      2 ############nginx##############
      3 - type: log
      4   enabled: true
      5   paths:
      6     - /var/log/nginx/access.log
      7   json.keys_under_root: true
      8   json.overwrite_keys: true
      9   tags: ["access"]
     10 
     11 - type: log
     12   enabled: true
     13   paths:
     14     - /var/log/nginx/error.log
     15   tags: ["error"]
     16 
     17 #############tomcat###############
     18 
     19 - type: log
     20   enabled: true
     25   tags: ["tomcat"]
     26  
     27 #############output###############
     28 
     29 setup.kibana:
     30    host: "10.0.0.31:5601"
     31 
     32 output.elasticsearch:
     33   hosts: ["10.0.0.31:9200"]
     34   #index: "nginx-%{[beat.version]}-%{+yyyy.MM}"
     35   indices:
     36     - index: "nginx_access-%{[beat.version]}-%{+yyyy.MM}"
     37       when.contains:
     38         tags: "access"
     39     - index: "nginx_error-%{[beat.version]}-%{+yyyy.MM}"
     40       when.contains:
     41         tags: "error"
     42     - index: "tomcat_access-%{[beat.version]}-%{+yyyy.MM}"
     43       when.contains:
     44         tags: "tomcat"
     45 
     46 ###########nginx模板###############
     47 setup.template.name: "nginx"
     48 setup.template.pattern: "nginx-*"
     49 setup.template.enabled: false
     50 setup.template.overwrite: true
     51 ###########tomcat模板##############
     52 setup.template.name: "tomcat"
     53 setup.template.pattern: "tomcat-*"
     54 setup.template.enabled: false
     55 setup.template.overwrite: true
  • 相关阅读:
    如何在Eclipse中查看Java类库的源代码以及相应的api
    深入剖析ConcurrentHashMap
    Java7/8 中的 HashMap 和 ConcurrentHashMap 全解析
    Quartz配置
    Spring 自动定时任务配置
    @Resource注解的官方解释
    @Resource 注解的使用
    扫地机器人会否抛弃激光雷达这位原配?
    女教授领军打造最耐用机器人,可从180米高空落下执行救援任务
    一文看懂80年“AI革命”简史
  • 原文地址:https://www.cnblogs.com/chenyuxia/p/14163912.html
Copyright © 2020-2023  润新知