【问题标题】:Fluentd High Availability Custom IndexFluentd 高可用性自定义索引
【发布时间】: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


    【解决方案1】:

    我在 fluent-plugin-elasticsearch 存储库中找到了一个 issue,它解释了这种行为。将“logstash_format”选项设置为 true 时,会忽略“index_name”字段。

    【讨论】:

      【解决方案2】:

      从 .remove logstash_format true 。您将获得自定义索引。但您不会在数据中获得时间戳。要获取时间戳,您必须更新 ruby​​ 版本,然后将时间格式传递给 fluentd 的配置文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多