diff --git a/example/in_forward.conf b/example/in_forward.conf new file mode 100644 index 0000000000..97a99257d2 --- /dev/null +++ b/example/in_forward.conf @@ -0,0 +1,7 @@ + + type forward + + + + type stdout + diff --git a/example/out_forward.conf b/example/out_forward.conf index 501a6ae4f3..79adc67b14 100644 --- a/example/out_forward.conf +++ b/example/out_forward.conf @@ -1,5 +1,6 @@ - type forward + type dummy + tag test @@ -7,18 +8,22 @@ # first server + host localhost port 24224 # second server + host localhost port 24225 # second server + host localhost port 24226 standby + flush_interval 1 send_timeout 60 heartbeat_type udp heartbeat_interval 1 diff --git a/lib/fluent/load.rb b/lib/fluent/load.rb index c1f408cc5c..ae227edc62 100644 --- a/lib/fluent/load.rb +++ b/lib/fluent/load.rb @@ -1,5 +1,6 @@ require 'thread' require 'socket' +require 'resolv' require 'fcntl' require 'time' require 'monitor' diff --git a/lib/fluent/plugin/out_forward.rb b/lib/fluent/plugin/out_forward.rb index e666be89c3..f46cc0a3d4 100644 --- a/lib/fluent/plugin/out_forward.rb +++ b/lib/fluent/plugin/out_forward.rb @@ -460,9 +460,8 @@ def resolved_host end def resolve_dns! - @sockaddr = Socket.pack_sockaddr_in(@port, @host) - port, resolved_host = Socket.unpack_sockaddr_in(@sockaddr) - return resolved_host + # shuffle to support dns round robin + Resolv.getaddresses(@host).shuffle!.first end private :resolve_dns!