1

我已经在 K8s 环境中部署了 Bitnami EFK 堆栈:

  repository: bitnami/fluentd
  tag: 1.12.1-debian-10-r0

目前,我的命名空间中的一个模块/应用程序配置为生成 JSON 日志。我将 Kibana 中的日志视为 JSON 格式。

但是在 16385 个字符之后存在拆分/截断日志的问题,并且我看不到完整的日志跟踪。我已经测试了一些 concat 插件,但到目前为止它们没有给出预期的结果。或者我做了错误的插件实现。

fluentd-inputs.conf: |
      # Get the logs from the containers running in the node
      <source>
        @type tail
        path /var/log/containers/*.log
        tag kubernetes.*
        <parse>
          @type json
          time_key time
          time_format %Y-%m-%dT%H:%M:%S.%NZ
        </parse>
      </source>
      # enrich with kubernetes metadata
      <filter kubernetes.**>
        @type kubernetes_metadata
      </filter>
      <filter kubernetes.**>
        @type parser
        key_name log
        reserve_data true
        <parse>
          @type json
        </parse>
      </filter>
      <filter kubernetes.**>
        @type concat
        key log
        stream_identity_key @timestamp
        #multiline_start_regexp /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d+ .*/
        multiline_start_regexp /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}
        flush_interval 5
      </filter>

    fluentd-output.conf: |
      <match **>
        @type forward
         # Elasticsearch forward
        <buffer>
          @type file
          path /opt/bitnami/fluentd/logs/buffers/logs.buffer
          total_limit_size 1024MB
          chunk_limit_size 16MB
          flush_mode interval
          retry_type exponential_backoff
          retry_timeout 30m
          retry_max_interval 30
          overflow_action drop_oldest_chunk
          flush_thread_count 2
          flush_interval 5s
          flush_thread_count 2
          flush_interval 5s
        </buffer>
      </match>
      {{- else }}
      # Send the logs to the standard output
      <match **>
        @type stdout
      </match>
      {{- end }}

我不确定,但一个原因可能是在 fluentd 配置中,一些插件已经用于过滤 JSON 数据,并且可能有一种不同的方式来使用新的 concat 插件。? 或者它可以以不同的方式配置。? https://github.com/fluent-plugins-nursery/fluent-plugin-concat

请问有人可以支持吗?谢谢

4

0 回答 0