apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentd
  labels:
    app: fluentd
    stack: efk
data:
  fluent.conf: |
    <source>
      @type http
      port 9880
      format json
    </source>

    <source>
      @type forward
      port 24224
    </source>


    <filter **>
      @type record_transformer
      enable_ruby
      <record>
        hostname "#{Socket.gethostname}"
      </record>
    </filter>


    <match fluent.**>
      @type stdout
    </match>

    <match application.error>
      @type elasticsearch
      host "$ELASTICSEARCH_HOST"
      port "$ELASTICSEARCH_PORT"
      scheme "$ELASTICSEARCH_SCHEME"
      user "$ELASTICSEARCH_USER"
      password "$ELASTICSEARCH_PASSWORD"
      include_tag_key true
      ssl_verify true
      reload_connections true
      logstash_format true
      logstash_dateformat %Y.%m.%d
      logstash_prefix application.error
      type_name log
      reconnect_on_error true
      num_threads 2
      <buffer>
        flush_thread_count 5
        flush_interval 5s
      </buffer>
    </match>
