We’re getting some webserver logs that contain urlencoded mac addresses. I’d like to normalise these before sending to loki, but i cant find a nice way to do it - is there something sensible im missing?
stage.replace seems like it’ll do what i want, but expression must be RE with capture blocks. Fine if there’s just one, but in a mac address, if i set this to .*(%3a).* it will match (and therefore replace) only the last occurrence. So this works:
```
stage.replace {
source = “device_mac_raw”
expression = “(?:[0-9A-Fa-f]{2})(%3[Aa]|-)(?:[0-9A-Fa-f]{2})(%3[Aa]|-)(?:[0-9A-Fa-f]{2})(%3[Aa]|-)(?:[0-9A-Fa-f]{2})(%3[Aa]|-)(?:[0-9A-Fa-f]{2})(%3[Aa]|-)(?:[0-9A-Fa-f]{2})”
replace = “:”
```
Is there a cleaner way?