简体   繁体   中英

Fluentd Dynamic Labeling for Grafana Loki

I set up fluentd with grafana loki, Since I have multiple microservices propagate logs to the fluentd I am unable to distinguish and filter the logs in Grafana. Could anyone help me to add my tag as a label so that I can query it like in grafana {tag:"tag.name"}. My fluentd config added below.

<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>

Use Dynamic Labeling

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM