Grafana Loki的流利动态标签

时间:2020-04-29 20:09:58

标签: grafana fluentd grafana-loki

我用grafana loki设置了流利的语言,因为我有多个微服务将日志传播到流利的语言,所以我无法区分和过滤Grafana中的日志。任何人都可以帮助我将标签添加为标签,以便像在grafana {tag:“ tag.name”}中一样对其进行查询。我的流利配置在下面添加。

<match TEST.**>
  @type loki  
  url "http://localhost:3100" 
 flush_interval 1s 
 flush_at_shutdown true 
 buffer_chunk_limit 1m  
extra_labels {"job":"TEST", "host":"ward_workstation", "agent":"fluentd"}  
<label>    
  filename  
</label>
</match>

1 个答案:

答案 0 :(得分:0)

使用动态标签

<filter TEST.**>
    @Type record_transformer
      <record>
        tag_name ${tag}
</record>
</filter>



<match TEST.**>
  @type loki  
  url "http://localhost:3100" 
 flush_interval 1s 
 flush_at_shutdown true 
 buffer_chunk_limit 1m  
extra_labels {"job":"TEST", "host":"ward_workstation", "agent":"fluentd"}  
<label>    
  tag_name
</label>
</match>