【问题标题】:how to set hotsname in index name in fluentd conf file如何在fluentd conf文件中的索引名称中设置hotsname
【发布时间】:2021-12-06 07:23:38
【问题描述】:

我想在 fluentd conf 文件的 index_name 中设置主机名。我是这样设置的,但它不起作用

<match output.**>
   @type copy
   <store>
    @type elasticsearch
        host elasticsearch
      ssl_version TLSv1_2
      ssl_verify false
      type_name _doc
      port 443
      scheme https
      flush_interval 10s
      index_name abc-${hostname}
    </store>
    <store>
      @type stdout
    </store>
  </match>

我怎样才能做到这一点?

【问题讨论】:

    标签: fluentd


    【解决方案1】:

    你的问题不是很清楚,但让我试着回答一下。 您可以在源代码部分实现它。 示例

      <source>
       type tail
       #format json
       path path_to_the_file
       pos_file /var/log/td-agent/buffer/somename
       tag hostname #in plain text(there are other methods too)
      </source>
    

    现在添加

    include_tag_key true
    logstash_prefix ${tag}
    logstash_format true
    

    到您的 &lt;match&gt; 主机后的部分并删除 index_name.. 这不是解决你问题的方法,但它会给你一个方向。

    【讨论】:

      猜你喜欢
      • 2021-02-07
      • 2023-01-15
      • 2018-09-05
      • 1970-01-01
      • 1970-01-01
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多