Special characters not supported in delimiter of json_lines codec

According to the documentation of json_lines codec plugin the default value of the delimiter option is newline (\n). However, when \n (or other unicode/special character like \x00) is explicitly defined in the input configuration of Logstash, it is considered to be a string containing of two characters:\ and n.

Thus, e.g. when using telnet connected to TCP port of Logstash, the version with default delimiter produces log output on every line whereas the version with delimiter produces a log output only when backslash + n are typed.

Any ideas why this happens and how to pass a delimiter which is a special character via configuration file?

Tested images: docker.elastic.co/logstash/logstash:5.6.5 and docker.elastic.co/logstash/logstash:6.1.1

Plugin version:

$ logstash-plugin list --verbose
...
logstash-codec-json_lines (3.0.5)
...

Example configuration:

input {
    tcp {
        codec => json_lines { 
          delimiter => "\n"
        }
        port => 12202
    }
}

output {
    stdout {
      codec => "json"
    }
}
1 Like

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