apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentd-logging
  namespace: kube-system
  labels:
    app: fluentd-logging
data: 
  fluent.conf: |
    ###################
    ##### SOURCES #####
    ###################

    <source>
      @type tail
      @id in_tail_container_logs
      tag hello.fluentd
      path /var/log/containers/hello-fluentd*.log
      pos_file /var/log/fluentd-containers.log.pos
      read_from_head true
      <parse>
        @type multi_format
        <pattern>
          format json
          time_key time
          time_type string
          time_format "%Y-%m-%dT%H:%M:%S.%NZ"
          keep_time_key false
        </pattern>
        <pattern>
          format regexp
          expression /^(?<time>.+) (?<stream>stdout|stderr)( (.))? (?<log>.*)$/
          time_format '%Y-%m-%dT%H:%M:%S.%NZ'
          keep_time_key false
        </pattern>
      </parse>
      emit_unmatched_lines true
    </source>

    ###################
    ##### FILTERS #####
    ###################

    # <filter hello.fluentd>
    #   @type record_transformer
    #   <record>
    #     test "FluentD Filter"
    #   </record>
    # </filter>

    ###################
    ##### OUTPUTS #####
    ###################
    
    <match hello.fluentd>
      @type stdout
    </match>
