replacing backslashes

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
_asp_
Posts: 91
Joined: Mon May 23, 2016 4:30 am

replacing backslashes

Post by _asp_ »

Hi, I have following stuff in a field:

"field_A" => "c:\\test\\test.txt"
rubydebug shows it as "c:\\\\test\\\\test.txt"

By some conversion the masking backslash became a valid character.
How can I get rid of the double backslashes, so that I have only one (or two when masked)?

I tried:

Code: Select all

mutate
{
  gsub =>
  [
    'field_A', '(\\\\)', '\\'
  ]
}
but that is not accepted by logstash.
If I try to replace to '[\\]' then the brackets are also inserted.

Any idea?
Thanks a lot.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: replacing backslashes

Post by eloyd »

Sorry, but this is broken within logstash itself: https://logstash.jira.com/browse/LOGSTASH-1377
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: replacing backslashes

Post by rkennedy »

Thanks @eloyd! Unfortunately, this is the answer.

@_asp_ let us know if you have further questions regarding this.
Former Nagios Employee
Locked