Class: LogStash::Inputs::Gelf
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Gelf
- Defined in:
- lib/logstash/inputs/gelf.rb
Overview
This input will read GELF messages as events over the network, making it a good choice if you already use Graylog2 today.
Constant Summary collapse
- RECONNECT_BACKOFF_SLEEP =
5
- TIMESTAMP_GELF_FIELD =
"timestamp".freeze
- SOURCE_HOST_FIELD =
"source_host".freeze
- MESSAGE_FIELD =
"message"
- TAGS_FIELD =
"tags"
- PARSE_FAILURE_TAG =
"_jsonparsefailure"
- PARSE_FAILURE_LOG_MESSAGE =
"JSON parse failure. Falling back to plain-text"
Instance Method Summary collapse
-
#initialize(params) ⇒ Gelf
constructor
A new instance of Gelf.
- #register ⇒ Object
- #run(output_queue) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(params) ⇒ Gelf
Returns a new instance of Gelf.
36 37 38 39 |
# File 'lib/logstash/inputs/gelf.rb', line 36 def initialize(params) super BasicSocket.do_not_reverse_lookup = true end |
Instance Method Details
#register ⇒ Object
42 43 44 |
# File 'lib/logstash/inputs/gelf.rb', line 42 def register require 'gelfd' end |
#run(output_queue) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/logstash/inputs/gelf.rb', line 47 def run(output_queue) begin # udp server udp_listener(output_queue) rescue => e unless stop? @logger.warn("gelf listener died", :exception => e, :backtrace => e.backtrace) Stud.stoppable_sleep(RECONNECT_BACKOFF_SLEEP) { stop? } retry unless stop? end end # begin end |
#stop ⇒ Object
61 62 63 64 |
# File 'lib/logstash/inputs/gelf.rb', line 61 def stop @udp.close rescue IOError # the plugin is currently shutting down, so its safe to ignore theses errors end |