Logstash output to tcp error it a signlge line that not ok

i have josn data use udp listener and output to tcp server .
to tcp server is the date is a single line . i don't want to a signlge line. need many lines.
i find this at https://www.elastic.co/guide/en/logstash/5.6/plugins-outputs-tcp.html#plugins-outputs-tcp-message_format

message_format (DEPRECATED) 
DEPRECATED WARNING: This configuration item is deprecated and may not be available in future versions.
Value type is string
There is no default value for this setting.
The format to use when writing events to the file. This value supports any string and can include %{name} and other dynamic strings.

If this setting is omitted, the full json representation of the event will be written as a single line.

but i don't know the value about message_format ?
is setting message_format => "json" ?

thanks.

by andy_zhou

It's not clear what you want to do. Do you want the tcp output to send each event as JSON? Or plain text spread over multiple lines?

out put to tcp as json one event is a line .
the input is many json events (use nc -4u import test ) is multiple lines.
but output to tcp server it know a signlge line json file .
i want the output is multiple lines. each line type is json .

Just use the json_lines codec.

tcp {
  ...
  codec => json_lines
}

this is output or input ? i add input not ok.

Output.

thanks so much
slove it .
i don't find this
codec => json_lines in the docs at https://www.elastic.co/guide/en/logstash/5.6/plugins-outputs-tcp.html#plugins-outputs-tcp
that so bad.
the other question
is all codec plugin https://www.elastic.co/guide/en/logstash/5.6/codec-plugins.html can add at input or output?
thanks.

i don't find this
codec => json_lines in the docs at Tcp output plugin | Logstash Reference [5.6] | Elastic
that so bad.

The codec option is documented and links to Structure of a Config File | Logstash Reference [6.2] | Elastic.

the other question
is all codec plugin Codec plugins | Logstash Reference [5.6] | Elastic can add at input or output?

Some of the codecs are specific to inputs or outputs but I think most of them can be used with but inputs and outputs.

thanks so.

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