Service_name is always unknown_service

Hi,

I setup a loki instance and started ingesting the logs using kube logging operator.

But it seems the service_name is always unknown_service.

I tried sending different fields like service_name, service.name and service, but nothing works it still shows the same unknown_service.

i restarted the loki cluster also but it didnt work.

example value of my service “monitoring______grafana__prometheus“

is this a known issue? or am i missing something?

your help is deeply appreciated,

thanks

Try to send desired service.name as resource (not log line) attribute.

got it, to set service as resource, i added the below in loki configuration:

labels:

  service: $.service

This resolved my issue and started grouping the logs properly.