We have observed drastic performance improvements on Linux, with proper kernel parameter settings (e.g. net.core.rmem_max parameter). If you have high-volume UDP traffic, please make sure to follow Before Installing Fluentd instructions.
Here is a Ruby example to send an event to in_udp:
FAQ
How to prevent request drop?
If in_udp gets lots of packets within 1 sec, some packets are dropped. For example, you can see bigger RcvbufErrors number via netstat -su.
This means that in_udp with one process cannot handle such traffic loads. Try multi workers.
How to receive binary data that contains newline bytes
If you are trying to receive binary data containing '\r' (0x0d) or '\n' (0x0a), you need to tweak remove_newline to prevent Fluentd from corrupting payloads.
For example, suppose you intend to receive packets which contain the following data:
you need to be careful that the default behaviour of Fluentd is to trim the 6th byte (0x0a) from payload. If you do not want this behaviour, please configure remove_newline to false.
require 'socket'
us = UDPSocket.open
sa = Socket.pack_sockaddr_in(5160, '127.0.0.1')
# This example uses json payload.
# In in_udp configuration, need to configure "@type json" in "<parse>"
us.send('{"k":"v1"}', 0, sa)
us.send('{"k":"v2"}', 0, sa)
us.close