记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

filebeat配置多日志并输出到elastic不同index索引


filebeat将 /var/log/secure与httpd的日志内容输出到ealsticsearch7.11.2的不同索引。

filebeat.inputs:

 - type: log
   enabled: true
   paths:
     - /var/log/secure
   include_lines: ['sshd', 'sudo']
   tags:
     ["secure-log"]   #自定义标签字段
   fields:
     index: "ssh"


 - type: log
   enabled: true
   paths:
     - /www/wwwlogs/httpd-ssl_access_log
#   include_lines: ['sshd', 'sudo']
   tags:
     ["httpd-log"]     #自定义标签字段
   fields:
     index: "httpd"



setup.template.settings:
  index.number_of_shards: 1


# output.console:
# pretty: true
# enable: true


output.elasticsearch:    #指定ES的配置,并指定不同的索引
  hosts: ["127.0.0.1"]
  username: "elastic"
  password: "123456"
  indices:
    - index: "filebeat-ssh-%{+YYYY-MM}"
      when.contains:
        fields:
          index: "ssh"
    - index: "filebeat-httpd-%{+YYYY-MM}"
      when.contains:
        fields:
          index: "httpd"


转载请标明出处【filebeat配置多日志并输出到elastic不同index索引】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论