UDP

Send logs to a remote UDP server

The UDP output plugin lets you send records to a remote UDP server. The payload can be formatted in different ways as required.

Configuration parameters

This plugin supports the following parameters:

Key
Description
Default

format

Specify the data format to be printed. Supported formats: msgpack, json, json_lines, json_stream.

json_lines

host

Target host where the UDP server is listening.

127.0.0.1

json_date_format

Specify the format of the date. Supported formats: double, epoch, epoch_ms, iso8601, java_sql_timestamp.

double

json_date_key

Specify the name of the time key in the output record. To disable the time key, set the value to false.

date

port

UDP port of the target service.

5170

raw_message_key

Use a raw message key for the message. When set, the plugin sends the value of this key as the raw message instead of formatting it as JSON.

none

workers

The number of workers to perform flush operations for this output.

2

Get started

To send records to a UDP server, you can run the plugin from the command line or through the configuration file.

Command line

The UDP plugin can read the parameters from the command line through the -p argument (property) or by setting them directly through the service URI. The URI format is the following:

udp://host:port

Using the format specified, start Fluent Bit through:

which is similar to:

Configuration file

In your main configuration file append the following:

JSON format examples

JSON lines format

This example sends CPU metrics in JSON lines format to a UDP server:

Run the following in a separate terminal, netcat will start listening for messages on UDP port 5170:

After Fluent Bit connects, you should see output in JSON format:

Raw message format

When raw_message_key is set, the plugin sends the value of the specified key as a raw message instead of formatting it as JSON. This is for when you want to send pre-formatted messages:

Message size limitations

UDP has a maximum datagram size of 65535 bytes. If a record exceeds this size, the plugin will send it but log a debug message. For large messages, consider using TCP or HTTP output plugins instead.

Testing

To test the UDP output plugin, you can use netcat to listen for incoming UDP messages:

Or use socat for more advanced testing:

Last updated

Was this helpful?