How can I add the value of the service_name label into the resulting message that is sent to Loki?

This is my Alloy configuration. I need to make it so that the value contained in service_name appears in the log message.
For example, with the current configuration, I receive a message like this:
2025-09-05 18:41:26.060 INFO some log message here…
But I need it to look like this:
2025-09-05 18:41:26.060 ${service_name} INFO some log message here…


discovery.kubernetes "pods" {
  role = "pod"
}

discovery.relabel "pod_logs" {
    targets = discovery.kubernetes.pods.targets
    rule {
      source_labels = ["__meta_kubernetes_namespace"]
      action = "keep"
      regex = "^(ldh.+|hive-metastore-dev)$"
    }
            
    rule {
      source_labels = ["__meta_kubernetes_namespace"]
      action = "replace"
      target_label = "application"
    }
    rule {
      source_labels = ["__meta_kubernetes_pod_name"]
      action = "replace"
      target_label = "pod"
    }
    rule {
      source_labels = ["__meta_kubernetes_pod_container_name"]
      action = "replace"
      target_label = "container_name"
    }

}

loki.source.kubernetes "pods" {
  targets = discovery.relabel.pod_logs.output
  forward_to = [loki.process.time_remover.receiver]
}

loki.process "time_remover" {
      
  stage.replace {
    expression = "(?P<timestamp>\\d{4}-\\d{2}-\\d{2}[ T]\\d{2}:\\d{2}:\\d{2}(?:[.,]\\d+)?Z?)"
    replace    = ""
  }

  stage.replace {
    expression = "(\\t)"
    replace    = "  "
  }

  stage.replace {
    expression = "(\\s{3,})"
    replace    = "  "
  }

  forward_to = [loki.write.grafana_loki.receiver]
}

loki.write "grafana_loki" {
  endpoint {
    url = "http://loki-gateway.logging.svc.cluster.local/loki/api/v1/push"
    tenant_id = "ldh"
  }
}

You will have to:

  1. First break up the original messages into two parts.
  2. Use stage.template and combine the two parts back into one, and insert service name inbetween.
  3. Use the new value for output.

Personally I would recommend you not to do this. It’s prone to errors.