Filebeat可通过配置输出模块的compress参数实现数据压缩,具体方式如下:
filebeat.yml(路径:Linux为/etc/filebeat/filebeat.yml,Windows为%ProgramData%\Filebeat\filebeat.yml)。output模块(如elasticsearch、logstash等)中添加compress: true,或指定压缩编解码器(如gzip)。
output.elasticsearch:
hosts: ["localhost:9200"]
compress: true # 启用压缩(默认为false)
output.logstash:
hosts: ["localhost:5044"]
compression: gzip # 可选值:none、gzip、snappy
注意:启用压缩会增加CPU负载,建议根据系统资源调整。