#fluetd-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: vetting-fluentd-config
  labels:
    app: fluentd
    kubernetes.io/cluster-service: "true"
data:
  fluent.conf: |
    <filter **>
      @type record_transformer
      <record>
        cluster {{ .Values.vettingEnv.clusterName }}
      </record>
    </filter>
    
    <match **>
      @type copy

      <store ignore_error>
        @type elasticsearch
        hosts https://{{ .Values.configmodulePy.elasticSearchUrl }}
        ssl_version TLSv1_2
        user {{ .Values.configmodulePy.elasticSearchUsername }}
        password {{ .Values.configmodulePy.elasticSearchPassword }}

        pipeline "vetting requests"
        include_timestamp true
        index_name "vetting-logs-{{ .Values.vettingEnv.clusterName }}"

        <buffer tag, time>
          @type memory
          timekey 60
          timekey_wait 0
        </buffer>
      </store>

      <store ignore_error>
        @type elasticsearch
        hosts https://{{ .Values.configmodulePy.elasticSearchUrl }}
        ssl_version TLSv1_2
        user {{ .Values.configmodulePy.elasticSearchUsername }}
        password {{ .Values.configmodulePy.elasticSearchPassword }}

        pipeline "vetting errors"
        include_timestamp true
        index_name "vetting-error-logs-{{ .Values.vettingEnv.clusterName }}"

        <buffer tag, time>
          @type memory
          timekey 60
          timekey_wait 0
        </buffer>
      </store>
    </match>