Promtail Kubernetes replace container-label


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

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

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