Open jordansissel opened 9 years ago
Actually you're right with this behaviour, for now the way it works is stripping out the configuration and then in the filter applying the set of operation in a given order, you can see it at https://github.com/logstash-plugins/logstash-filter-mutate/blob/master/lib/logstash/filters/mutate.rb#L211-L222 in case the configuration option was provided.
Changing this would require a certain design changes in logstash per se, but I see the pain of expecting the operation to be applied in a given order. We'll investigate more on how to provide an improvement for this behaviour. In the meanwhile if you aim to get a given order is good to have different mutates.
I would recommend for example your solution for now.
Is this going to be solved (not a workaround using 2 blocks) in the near future?
Maybe add the label docs
as it would make sense to describe the defined order in the docs as in the docs the operations are listed in alphabetical order, which does not correspond to the order how the mutations are applied.
(This issue was originally filed by @ndelucin at https://github.com/elastic/logstash/issues/1877)
Hi,
I discovered a strange issue regarding mutate evaluation. Don-t know if its a bug or a normal behavior of the Logstash "interpreter"...
Let me explain... I have a "hostname" field containing a FQDN such like "mycomputer.my.domain.com" Aim is to "clean" this field to only store the computer name (1st part of FQDN): hostname="mycomputer.my.domain.com" => filtering => hostname="mycomputer"
So I applied the following filter{} in my logstash conf file:
but, it did not work at all. Here is stdout:
_BUT !!_ If I re-arrange instructions into 2 distinct mutate blocks like this:
Then it works like a charm:
Do you know why ?
Thanks !