elasticsearch 没有从TD代理传递到ElasticSearch的主机名/标记,elasticsearch,kibana,fluentd,elasticsearch,Kibana,Fluentd" /> elasticsearch 没有从TD代理传递到ElasticSearch的主机名/标记,elasticsearch,kibana,fluentd,elasticsearch,Kibana,Fluentd" />

elasticsearch 没有从TD代理传递到ElasticSearch的主机名/标记

elasticsearch 没有从TD代理传递到ElasticSearch的主机名/标记,elasticsearch,kibana,fluentd,elasticsearch,Kibana,Fluentd,我正在尝试将事件从TD代理发送到ElasticSearch和Kibana,但它不起作用 我的Td代理配置: <source> type tail path /var/log/abc.log pos_file /etc/td-agent/def.pos refresh_interval 10s tag "abc.def" format /^(?<Time>[^ ]* [^ ]*) (?<Logging_Level>\[(.*)\])

我正在尝试将事件从TD代理发送到ElasticSearch和Kibana,但它不起作用

我的Td代理配置:

  <source>
  type tail
  path /var/log/abc.log
  pos_file /etc/td-agent/def.pos
  refresh_interval 10s
  tag "abc.def"
  format /^(?<Time>[^ ]* [^ ]*) (?<Logging_Level>\[(.*)\]) (?<PID>\  [(.*)\]) \[\-\:\-\] (?<Message>(.*))$/
  time_format %Y-%m-%d %H:%M:%S
 </source>

 <filter "abc.def">
 type record_transformer
  <record>
    hostname "#{Socket.gethostname}"
  </record>
 </filter>

 <match "abc.def">
 type elasticsearch
 logstash_format true
  host xyz.def.domain
  port 9200 #(optional; default=9200)
  flush_interval 10s
  index_name logstash #(optional; default=fluentd)
   </match>

型尾
路径/var/log/abc.log
pos_文件/etc/td-agent/def.pos
刷新间隔10秒
标签“abc.def”
格式/^(?[^]*[^]*)(?\[(.*)\])(?\[(.*)\])\[\-\:\-\](?(.*))$/
时间\u格式%Y-%m-%d%H:%m:%S
型记录变压器
主机名“#{Socket.gethostname}”
类型弹性搜索
logstash_格式为true
主机xyz.def.domain
端口9200#(可选;默认值=9200)
冲洗间隔10s
索引名称logstash(可选;默认值=fluentd)

不确定为什么它没有将主机名从TD代理发送到ElasticSearch和Kibana?

您应该在record\u transformer中启用ruby,这是ruby表达式:

"#{Socket.gethostname}"
所以它应该是这样的:

 <filter "abc.def">
 type record_transformer
 enable_ruby true 
 <record>
    hostname "#{Socket.gethostname}"
  </record>
 </filter>

型记录变压器
启用\u ruby true
主机名“#{Socket.gethostname}”