You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已配置JSON格式,Fluentd仍报"not in gzip format"错误求助

问题解决:Fluentd S3源报"not in gzip format"错误

问题原因

你的日志文件是未压缩的纯文本,但Fluentd的S3源插件默认会尝试gzip解压所有读取的对象——这和你配置的<format> json是两个独立环节:<format>负责解析日志内容的格式,而compression参数控制文件是否需要解压处理。插件误将未压缩的纯文本当作gzip文件解压,因此抛出Zlib错误。

解决方案

在S3源配置中显式添加compression none参数,禁用自动解压:

修改后的完整配置:

# fluentd/conf/fluent.conf

<source>
  @type s3

  aws_key_id <mykey>
  aws_sec_key <mypassword>
  s3_bucket <bucket>
  s3_region eu-central-1
  add_object_metadata true
  compression none  # 新增该行,禁用解压逻辑
  <format>
    @type json
  </format>
  <sqs>
    queue_name <queue>
  </sqs>
</source>

<match *.**>
  @type copy

  <store>
    @type elasticsearch
    host elasticsearch
    port 9200
    logstash_format true
    logstash_prefix gql_cloudwatch
    logstash_dateformat %Y%m%d
    include_tag_key true
    type_name access_log
    tag_key @log_name
    flush_interval 1s
  </store>

  <store>
    @type stdout
  </store>
</match>

额外排查点

  • 确认S3文件状态:检查桶中的日志文件确实是未压缩的纯文本,没有被意外gzip压缩。
  • 文件后缀检查:避免使用.gz作为未压缩文件的后缀,否则插件可能自动触发解压逻辑。
  • 混合压缩场景处理:如果桶中同时存在压缩和未压缩文件,可将compression设为auto,让插件自动检测并适配文件状态。

内容的提问来源于stack exchange,提问作者user2086359

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 18:20:09