【问题标题】:how to create multiple index in elasticsearch using fluentd ( td-agent.cong)如何使用fluentd(td-agent.cong)在elasticsearch中创建多个索引
【发布时间】:2016-10-18 08:07:32
【问题描述】:

我正在设置 EFK 堆栈。在 Kibana 中,我想代表一个应用程序索引和一个系统日志索引。

我正在使用 fluentd 进行日志转发。

系统日志 --> /var/log/messages 和 /var/log/secure

应用程序 --> /var/log/application.log

什么是td-agent.cong来创建两个索引请帮忙

谢谢你

【问题讨论】:

    标签: elasticsearch kibana-4 fluentd


    【解决方案1】:

    如果您正在使用 ElasticSearch 输出插件并想使用 kibana,您可以通过更改 logstash_prefix 属性来配置索引名称。

    阅读文档:elasticsearch output plugin documentation

    我添加了以下 fluentd.conf 文件来演示您的用例。 在这个文件中,我有 2 个匹配项: 1. “alert” - 将所有带有“alert”(FluentLogger.getLogger(“alert”))的日志通过管道传输到 elasticsearch 中的“alert”索引。

    1. 默认匹配 - 将所有日志通过“fluentd”索引(这是该插件的默认索引)通过管道传输到 elasticsearch。

      fluentd/conf/fluent.conf

      @type 转发 端口 24224 绑定 0.0.0.0

      <match alert.**>
        @type copy
        <store>
          @type elasticsearch
          host elasticsearch
          port 9200
          logstash_format true
          logstash_prefix alert
          logstash_dateformat %Y%m%d
          type_name access_log
          tag_key @log_name
          flush_interval 1s
        </store>
        <store>
          @type stdout
        </store>
      </match>
      
      
      <match *.**>
        @type copy
        <store>
          @type elasticsearch
          host elasticsearch
          port 9200
          logstash_format true
          logstash_prefix fluentd
          logstash_dateformat %Y%m%d
          include_tag_key true
          type_name access_log
          tag_key @log_name
          flush_interval 1s
        </store>
        <store>
          @type stdout
        </store>
      </match>
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-19
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2016-08-20
      • 2018-04-07
      • 2018-05-29
      • 2021-05-10
      相关资源
      最近更新 更多