I'm in the middle of implementing a PostgreSQL log parser that will normalize the queries so I can do stats on them. As part of this, I need to be able to search for components of fields and replace them with back references plus some extra text. Example of one such line (replacement string contains a \1, which in Ruby at least should bring in the element found within the () in the search string::
mutate {
gsub => [
"normalized_query" , "([^a-z_$-])-?([0-9]+)", "\10"
]
}
Question 1: Does this work? I am not going to get a chance to test it today, but hoped someone could chime in on this in case my simple-minded belief that a Ruby back-reference would work. I hope it does.
The other question is, if you have a bunch of gsubs in the same mutate function, and they all operate on the same field, will the changes be applied in serial order? I didn't see anything in the docs about this. I assume it's the case, but thought I'd ask.
Thanks!