Class: LogStash::Inputs::Pcap
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Pcap
- Defined in:
- lib/logstash/inputs/pcap.rb
Overview
This plugin works into getting data from your networks into logstash by leveraing the libpcap capabilities in your OS.
Instance Method Summary collapse
- #register ⇒ Object
-
#run(queue) ⇒ Object
def register.
Instance Method Details
#register ⇒ Object
19 20 21 22 |
# File 'lib/logstash/inputs/pcap.rb', line 19 def register require "pcap" @client = Jruby::Pcap.live(@interface) end |
#run(queue) ⇒ Object
def register
24 25 26 27 28 29 30 31 32 |
# File 'lib/logstash/inputs/pcap.rb', line 24 def run(queue) @client.each do |packet| payload = { :timestamp => packet. } payload.merge!(packet.to_hash) event = LogStash::Event.new(payload) decorate(event) queue << event end end |