栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

fluentd损失了毫秒,现在日志消息在elasticsearch中被无序存储

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

fluentd损失了毫秒,现在日志消息在elasticsearch中被无序存储

fluentd当前不支持亚秒级分辨率:https :
//github.com/fluent/fluentd/issues/461

我通过使用record_reformer向所有日志消息添加新字段来存储自纪元以来的纳秒来解决此问题

例如,如果您的流利性输入如下:

## Syslog#<source>    type syslog    port 5140    bind localhost    tag syslog</source>## Tomcat log4j json output#<source>    type tail    path /home/foo/logs/catalina-json.out    pos_file /home/foo/logs/fluentd.pos    tag tomcat    format json    time_key @timestamp    time_format "%Y-%m-%dT%H:%M:%S.%L%Z"</source>

然后将其更改为如下所示,并添加一个record_reformer,该记录添加一个纳秒级的字段

## Syslog#<source>    type syslog    port 5140    bind localhost    tag cleanup.syslog</source>## Tomcat log4j json output#<source>    type tail    path /home/foo/logs/catalina-json.out    pos_file /home/foo/logs/fluentd.pos    tag cleanup.tomcat    format json    time_key @timestamp    time_format "%Y-%m-%dT%H:%M:%S.%L%Z"</source><match cleanup.**>    type record_reformer    time_nano ${t = Time.now; ((t.to_i * 1000000000) + t.nsec).to_s}    tag ${tag_suffix[1]}</match>

然后将time_nano字段添加到您的kibana仪表板中,并使用它而不是@timestamp进行排序,一切都会井井有条。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/369625.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号