Remove json new line \n

I am pulling a JSON input via http_poller, the data has "\n" throughout the data that I would like to remove it

Here is an example of a date that contains the "\n"

"O 151007Z FEB 17\n"

Here is my input

input{
http_poller{
urls => {
test1 => "..."
test2 => {
method => get
url => "..."
headers => {
Accept => "application/json"
}
}
}
codec => "json"
}
}

I have tried
filter{
mutate { gsub => [ "message", "[\n]", "" ] }
}

and suggestions from here with no success.

Do not escape the newline.

mutate { gsub => [ "message", "
", "" ] }

My new input is

input {
 http_poller {
    urls => {
      test1 => ".."
      test2 => {
        method => get
        url => "..."
        headers => {
        Accept => "application/json"
        }
     }
    }
    type => "..."
    request_timeout => 60
    codec => "json"
    metadata_target => "http_poller_metadata"
  }
}
filter {
   json {
     source => "message"
   }
   mutate { gsub => [ "messages", "
 ", "" ] }
}

The output has not changed and is

"O 151007Z FEB 17\n"

In Kibana, the "\n" is only visible in the JSON source, but it causes issues when trying to parse the date as I am only able to parse dates without the new line \n "O 151007Z FEB 17" correctly.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.