graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)
https://rubygems.org/gems/gelf
MIT License
153 stars 104 forks source link

Feature Request: Support multiple target addresses in GELF::Notifier #104

Open afreiberger opened 2 years ago

afreiberger commented 2 years ago

In the logstash-output-gelf project, there is a feature request to support multiple GELF destination hosts. https://github.com/logstash-plugins/logstash-output-gelf/issues/4

The GELF::Notifier initiator and the create_sender methods in this module would need to support passing multiple hosts and/or ports in order to properly address multiple destination GELF units when instantiating the transport layer.

The backend TCP, UDP, and TCP-TLS transport layers incorporate socket and failover management if provided with multiple addresses, however the GELF::Notifier module does not expose this functionality to consumers of this library.

The Notifier instantiation begins here and ends with a call to create_sender with a single host and port. https://github.com/graylog-labs/gelf-rb/blob/master/lib/gelf/notifier.rb#L25

The create_sender definition is here: https://github.com/graylog-labs/gelf-rb/blob/master/lib/gelf/notifier.rb#L137

This line of create_sender packs the single host and port into the proper array of host, port tuples, and requires further expansion to support multiple backend servers. https://github.com/graylog-labs/gelf-rb/blob/master/lib/gelf/notifier.rb#L138