Promtail Kubernetes replace container-label

Hi,

I’m trying to replace how our container-labels are being parsed. We have quite a few pods restarting daily and they generate a lot of different logs like container: name-(randomstring). I’m trying to remove the -(randomstring) part so we only have the container: name label, but I can’t seem to figure out how to do that exactly. Trying to work it out with the match-replace stage, but it doesn’t work

    match:
      selector: '{app="app1"}'
      stages:
        - replace:
            expression: ".*"
            source: "container"
            replace: "test"

If someone could push me in the right direction, that would be highly appreciated!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.