【发布时间】:2019-07-09 19:37:01
【问题描述】:
我正在尝试设置一个流利的服务来收集日志并将它们发送到弹性搜索。
一切都很好,除了我无法获得自定义索引名称并保持时间戳类似于 logstash_format: true 的时间戳。
这是我的 fluent.conf 文件:
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match *.**>
@type copy
<store>
@type elasticsearch
hosts hostaddressandport
user theuser
password password
include_tag_key true
tag_key @log_name
index_name myindex-%Y.%m
<buffer>
flush_interval 3s
</buffer>
</store>
</match>
索引是在弹性字面上创建的,它显示myindex-%Y.%m 我已经尝试过 myindex-${%Y.%m} 并获得相同的行为。
如果我改用logstash_format: true,那么我会得到一个类似logstash-2019.07.09 的索引,但我不希望这样。
这是我从 https://docs.fluentd.org/output/elasticsearch 获得想法的地方,但我没有看到预期的行为。
我在上面提到的文档中找到了以下内容:
<buffer tag, time>
timekey 1h # chunks per hours ("3600" also available)
</buffer>
但它很模糊,我不明白 chunk_keys 是什么。
【问题讨论】:
-
你能试试这个,让我知道它是否有效吗?
index_name "myindex-%Y.%m"将引号移到外面。 -
对我也不起作用?你找到解决办法了吗