---
apiVersion: v1
kind: ConfigMap
metadata:
  name: fluent-bit
  namespace: fluent-bit
  labels:
    app: fluent-bit
data:
  fluent-bit.conf: |
    [SERVICE]
        Flush        5
        Daemon       Off
        Log_Level    ${LOG_LEVEL}
        Health_Check On
        HTTP_Server  On
        HTTP_Listen  0.0.0.0
        HTTP_Port    2020
        Parsers_File parsers.conf
        Parsers_File parsers_custom.conf

    [INPUT]
        Name              tail
        Path              /var/log/containers/*.log
        Parser            docker
        Tag               kube.*
        Refresh_Interval  5
        Mem_Buf_Limit     20MB
        Skip_Long_Lines   On
        DB                /tail-db/tail-containers-state.db
        DB.Sync           Normal

    [FILTER]
        Name                kubernetes
        Match               kube.*
        Kube_Tag_Prefix     kube.var.log.containers.
        Kube_URL            https://kubernetes.default.svc:443
        Kube_CA_File        /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        Kube_Token_File     /var/run/secrets/kubernetes.io/serviceaccount/token
        Merge_Log           On
        Merge_Log_Key       content
        K8S-Logging.Parser  On
        K8S-Logging.Exclude On

    [FILTER]
        Name  modify
        Match *
        Add   cluster fluent-bit-kafka-clickhouse

    [OUTPUT]
        Name                          kafka
        Match                         *
        Brokers                       kafka-kafka-0.kafka-kafka-brokers.kafka.svc.cluster.local:9092,kafka-kafka-1.kafka-kafka-brokers.kafka.svc.cluster.local:9092,kafka-kafka-2.kafka-kafka-brokers.kafka.svc.cluster.local:9092
        Topics                        fluent-bit
        Queue_Full_Retries            10
        rdkafka.log.connection.close  false
        rdkafka.request.required.acks 1

  parsers.conf: |
    [PARSER]
        Name        logfmt
        Format      logfmt
