The tcp output plugin allows to send records to a remote TCP server. The payload can be formatted in different ways as required.
Configuration Parameters
Key
Description
default
Host
Target host where Fluent-Bit or Fluentd are listening for Forward messages.
127.0.0.1
Port
TCP Port of the target service.
5170
Format
Specify the data format to be printed. Supported formats are msgpackjson, json_lines and json_stream.
msgpack
json_date_key
Specify the name of the time key in the output record. To disable the time key just set the value to false.
date
json_date_format
Specify the format of the date. Supported formats are double, epoch, iso8601 (eg: 2018-05-30T09:39:52.000681Z) and java_sql_timestamp (eg: 2018-05-30 09:39:52.000681)
double
Workers
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
2
TLS Configuration Parameters
The following parameters are available to configure a secure channel connection through TLS:
Key
Description
Default
tls
Enable or disable TLS support
Off
tls.verify
Force certificate validation
On
tls.debug
Set TLS debug verbosity level. It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose
We have specified to gather CPU usage metrics and send them in JSON lines mode to a remote end-point using netcat service.
Run the following in a separate terminal, netcat will start listening for messages on TCP port 5170. After it connects to Calyptia Core Agent ou should see the output as above in JSON format:
We could send this to stdout but as it is a serialized format you would end up with strange output. This should really be handled by a msgpack receiver to unpack as per the details in the developer documentation here. As an example we use the Python msgpack library to deal with it: