fluentd - 从 fluentd 发送到 aws kinesis firehose 时数据丢失
问题描述
我们正在使用fluentd将日志发送到aws kinesis firehose。我们可以看到很少有记录不时发送到 aws kinesis firehose。这是我们在fluentd中的设置。
<system>
log_level info
</system>
<source>
@type tail
path "/var/log/app/tracy.log*"
pos_file "/var/tmp/tracy.log.pos"
pos_file_compaction_interval 72h
@log_level "error"
tag "tracylog"
<parse>
@type "json"
time_key False
</parse>
</source>
<source>
@type monitor_agent
bind 127.0.0.1
port 24220
</source>
<match tracylog>
@type "kinesis_firehose"
region "${awsRegion}"
delivery_stream_name "${delivery_stream_name}"
<instance_profile_credentials>
</instance_profile_credentials>
<buffer>
# Frequency of ingestion
flush_interval 30s
flush_thread_count 4
chunk_limit_size 1m
</buffer>
</match>
解决方案
配置中的一些更改解决了我的问题:
<system>
log_level info
</system>
<source>
@type tail
path "/var/log/app/tracy.log*"
pos_file "/var/tmp/tracy.log.pos"
pos_file_compaction_interval 72h
read_from_head true
follow_inodes true
@log_level "error"
tag "tracylog"
<parse>
@type "json"
time_key False
</parse>
</source>
<source>
@type monitor_agent
bind 127.0.0.1
port 24220
</source>
<match tracylog>
@type "kinesis_firehose"
region "${awsRegion}"
delivery_stream_name "${delivery_stream_name}"
<instance_profile_credentials>
</instance_profile_credentials>
<buffer>
flush_interval 2
flush_thread_interval 0.1
flush_thread_burst_interval 0.01
flush_thread_count 8
</buffer>
推荐阅读
- javascript - 如何刷新绑定?
- selenium-chromedriver - WCT 无法在 Redhat Linux 中检测到 google chrome 浏览器
- javascript - 如何将从 postgres 数据库中选择的数据转换为 json 或 csv 以将其与 d3js lib 一起使用?
- gradle - 使用 gradle 合并 jar 以进行拆分包
- android - 从 Play 商店下载 apk 后,Google 地图无法在 Android 中运行
- android - 将图像沿某些表单数据 Retrofit 发布到 WCF Rest
- primeng - PrimeNg Steps 组件编号
- python - Python脚本使字符串与放置的字符的每个组合
- jsf - 在生产模式下禁用相位监听器
- php - 未找到 PHP Symfony curl 发布数据