elasticsearch 如何添加时间戳&;使用fluent进行elasticsearch的键
我已经配置了fluentd和elasticsearch,它们都工作得很好。我跟踪一个文件,然后读取其数据并将其发布到elasticsearch。以下是json数据:
elasticsearch 如何添加时间戳&;使用fluent进行elasticsearch的键,
elasticsearch,logging,fluentd,
elasticsearch,Logging,Fluentd,我已经配置了fluentd和elasticsearch,它们都工作得很好。我跟踪一个文件,然后读取其数据并将其发布到elasticsearch。以下是json数据: {"time": "2018-05-14T11:37:30.339593", "Data count": 78, "Data status": "Sent", "DataId": "332"} 下面是fluentd配置文件: <source> @type tail time_key time path /h
{"time": "2018-05-14T11:37:30.339593", "Data count": 78, "Data status": "Sent", "DataId": "332"}
下面是fluentd配置文件:
<source>
@type tail
time_key time
path /home/user/file.json
format json
tag first
</source>
<match *first*>
@type elasticsearch
hosts 192.168.196.118:9200
user <username>
password <password>
index_name myindex
type_name mytype
id_key 100
time_key time
</match>
@型尾
时间键时间
path/home/user/file.json
格式json
先标记
@类型弹性搜索
主机192.168.196.118:9200
使用者
密码
索引\名称myindex
类型\名称mytype
id_键100
时间键时间
在上面的配置文件中,我添加了time\u key
,因为time是我希望从json数据中使用的时间。但是我在elasticsearch
中收到的数据不包含任何时间数据
此外,我使用的是id\u键
,但在elasticsearch中,id\u键是一些随机值
请帮忙。谢谢尝试注入您想要的值:
<inject>
time_key @log_time
time_format %Y%m%dT%H%M%S%z
</inject>
时间键@日志时间
时间\u格式%Y%m%dT%H%m%S%z
按照以下说明操作:我已解决此问题。我不需要在配置文件中添加任何额外的内容。我只是在elasticsearch中选择了时间作为时间域。您是否仔细检查了elasticsearch插件是否支持此功能?