Class: LogStasher::Device::UDP
- Inherits:
-
Object
- Object
- LogStasher::Device::UDP
- Includes:
- LogStasher::Device
- Defined in:
- lib/logstasher/device/udp.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options = {}) ⇒ UDP
constructor
A new instance of UDP.
- #write(log) ⇒ Object
Methods included from LogStasher::Device
Constructor Details
#initialize(options = {}) ⇒ UDP
Returns a new instance of UDP.
14 15 16 17 |
# File 'lib/logstasher/device/udp.rb', line 14 def initialize( = {}) = .merge(stringify_keys()) @socket = UDPSocket.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/logstasher/device/udp.rb', line 12 def end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
12 13 14 |
# File 'lib/logstasher/device/udp.rb', line 12 def socket @socket end |
Instance Method Details
#close ⇒ Object
19 20 21 |
# File 'lib/logstasher/device/udp.rb', line 19 def close @socket.close end |
#write(log) ⇒ Object
23 24 25 |
# File 'lib/logstasher/device/udp.rb', line 23 def write(log) @socket.send(log, 0, ['hostname'], ['port']) end |