【发布时间】:2015-10-22 20:18:35
【问题描述】:
我设置了一个 fluentd/elasticsearch/kibana 堆栈,与here 所描述的非常相似。当我查看 kibana 中的日志时,我注意到它们使用“logstash-[YYYY].[MM].[DD]”格式自动按天编制索引。根据fluentd elasticsearch plugin 的文档,您似乎可以创建通过设置“index_name”属性来自定义索引。
我在日志转发器和日志聚合器上都试过这个,但我似乎仍然在 elasticsearch 中获得默认索引名称。在 HA 设置中自定义此索引名称是否还需要其他内容?
这里是日志转发器配置:
<source>
type tail
path /var/log/debug.json
pos_file /var/log/debug.pos
tag asdf
format json
index_name fluentd
time_key time_field
</source>
<match *>
type copy
<store>
type stdout
</store>
<store>
type forward
flush_interval 10s
<server>
host [fluentd aggregator]
</server>
</store>
</match>
这里是日志聚合器配置:
<source>
type forward
port 24224
bind 0.0.0.0
</source>
<match *>
type copy
<store>
type stdout
</store>
<store>
type elasticsearch
host localhost
port 9200
index_name fluentd
type_name fluentd
logstash_format true
include_tag_key true
flush_interval 10s # for testing
</store>
</match>
【问题讨论】:
标签: elasticsearch logstash kibana fluentd