fluent / fluent/fluentd

Multicast support in UDP input

Open
#4,286 2 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
13.6k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
20

Description

### Is your feature request related to a problem? Please describe.

UDP input supports only unicast connections.

### Describe the solution you'd like

Add a group parameter to the UDP input plugin configuration, e.g.:

```ruby
desc 'The multicast group address to join to.'
config_param :group, :string, default: nil
```
If the user provides the value and it is a valid multicast IP address, join the socket to the multicast group of that address.

### Describe alternatives you've considered

I cloned builtin `in_udp.rb` and added the necessary code:

```ruby
def multi_workers_ready?
false
end

def start
super

log.info "listening udp socket", bind: @bind, port: @port
server = server_create(:in_udp_server, @port, proto: :udp, bind: @bind, resolve_name: !!@source_hostname_key, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
# ...
end

@membership = IPAddr.new(@group).hton + IPAddr.new(@bind).hton
sock = server.instance_variable_get(:@sock)
sock.setsockopt(:IPPROTO_IP, :IP_ADD_MEMBERSHIP, @membership)
end
```

### Additional context

The difference between unicast and multicast is in the lower protocol, IP, and is taken care of by the network infrastructure. The rest from the user perspective is the same; therefore, I think multicast support should be an option in the built-in UDP input plugin.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.