apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentd-config
  namespace: efk
data:
  fluent.conf: |
    <source>
      @type http
      @id input_http
      port 8888
      tag sardine.log
      @label @main
    </source>

    <label @main>
      <match sardine.log.**>
        @type copy
        <store>
          @type elasticsearch
          @id output_elasticsearch
          host elasticsearch
          port 9200
          scheme http
          user fluentd_user
          password fluentd_password
          logstash_format true
          logstash_prefix logstash
          logstash_dateformat %Y.%m.%d
          flush_interval 5s  # 缩短批量写入间隔
          @log_level debug
          id_key _id
          remove_keys _id
        </store>
        <store>
          @type stdout
          @id output_stdout
        </store>
      </match>
    </label>

    <match **>
      @type stdout
      @id output_stdout_all
    </match>