Hi, we are facing srevice/service_name = unknown_service issue, Plugin used is fluent-plugin-grafana-loki. We tried below config in Loki chart and the other config on fluentd side, please check and advise:
Loki-chart-config:
limits_config:
discover_service_name:
- index
Fluentd-side config:
index $.index
service_name $.index
service $.index
</label>
full fluentd loki-config:
<label @REWRITTEN>
<match \*\*>
@type loki
url "#{ENV\['LOKI_URL'\]}"
ca_cert /secure/tls-certs/ca.crt
line_format json
\# FIX 1: Provide ONLY 'index' and 'valli'.
\# Remove 'service_name' and 'service' so Loki's chart can discover 'index' automatically.
<label>
valli $.index
index $.index
service_name $.index
service $.index
</label>
\# FIX 2: Do NOT include 'remove_keys index'.
\# If you remove it here, Fluentd's buffer chunking breaks during evaluation.
\# FIX 3: Keep $.index as the primary memory chunk routing key.
<buffer $.index>
@type memory
flush_interval 1s
retry_type periodic
retry_forever false
retry_wait 10s
retry_max_times 2
chunk_limit_size 8m
total_limit_size 256MB
overflow_action drop_oldest_chunk
flush_thread_count 16
queued_chunks_limit_size 32
flush_at_shutdown true
</buffer>
</match>
</label>