I am attempting to truncate my messages coming in through my logstash forwarder. My data is ok to truncate and without truncation it is being cut off in my log provider causing json breakage.
I had added the following config to my logstash config
filter {
mutate {
rename => { "message" => "@message" }
}
mutate {
gsub => ["@message", "^.{1000}(.*)$", "..."]
}
}
My assumption is that gsub regex will get from the 1001st character till end of field value and replace it with "..."
I also had to rename the field message to @message to keep it consistent.
But it does not seem to want to trim at all. This is with logstash 2.3.
Any ideas of what I may be doing wrong or another filter type I should be using to do truncation?