分类

链接

2023 年 8 月
 123456
78910111213
14151617181920
21222324252627
28293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > DevOps, Docker, 系统架构 > 正文
共享办公室出租
filebeat按docker容器名创建不同的索引
DevOps, Docker, 系统架构 暂无评论 阅读(206)

直接看配置:

processors:
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - drop_event:
      when.or:
        - equals:
            container.name: "filebeat"
        - equals:
            container.name: "kibana"
        - equals:
            container.name: "es"
        - equals:
            container.name: "redis"   
        - equals:
            container.name: "elastalert"
        - equals:
            container.name: "mysql"
        - equals:
            container.name: "traefik"

            
  # - add_fields:
  #     target: ''
  #     fields:
  #       ip: '${serverIP}'
filebeat.inputs:
  - type: docker
    combine_partial: true
    containers:
      path: "/var/lib/docker/containers"
      ids: "*"
    multiline.pattern: '^\d{4}-\d{2}-\d{2}'
    multiline.negate: true
    multiline.match: after
  # - type: log
  #   enable: true
  #   paths: 
  #     - /var/log/yum.log
  # - type: container
  #   combine_partial: true
  #   paths:
  #     - '/var/lib/docker/containers/*/*.log'
filebeat.config:
  modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false
output.elasticsearch:
  hosts: 'es:9200'
  username: "elastic"
  password: "密码"
  
  #这里为输出新增代码
  indices:
    - index: "docker-%{[container.name]}-%{+yyyy.MM}"

setup.kibana:
  host: "kibana:5601"


#主要是这个配置(filebeat版本7+)
setup.template.name: "docker"
setup.template.pattern: "docker-*"
setup.template.enabled: true
setup.template.overwrite: true
setup.ilm.enabled: false



 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:filebeat按docker容器名创建不同的索引 | Bruce's Blog

发表评论

留言无头像?