Class: LogStash::Outputs::SumoLogic
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::SumoLogic
- Includes:
- Common, PluginMixins::HttpClient
- Defined in:
- lib/logstash/outputs/sumologic.rb,
lib/logstash/outputs/sumologic/piler.rb,
lib/logstash/outputs/sumologic/common.rb,
lib/logstash/outputs/sumologic/sender.rb,
lib/logstash/outputs/sumologic/monitor.rb,
lib/logstash/outputs/sumologic/compressor.rb,
lib/logstash/outputs/sumologic/statistics.rb,
lib/logstash/outputs/sumologic/message_queue.rb,
lib/logstash/outputs/sumologic/header_builder.rb,
lib/logstash/outputs/sumologic/payload_builder.rb
Overview
Now you can use logstash to deliver logs to Sumo Logic
Create a HTTP Source in your Sumo Logic account and you can now use logstash to parse your log and send your logs to your account at Sumo Logic.
Defined Under Namespace
Modules: Common Classes: Compressor, HeaderBuilder, MessageQueue, Monitor, PayloadBuilder, Piler, Sender, Statistics
Constant Summary
Constants included from Common
Common::CARBON2, Common::DEFAULT_LOG_FORMAT, Common::DEFLATE, Common::GRAPHITE, Common::GZIP, Common::LOG_TO_CONSOLE, Common::METRICS_NAME_PLACEHOLDER, Common::STATS_TAG
Instance Attribute Summary collapse
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
-
#close ⇒ Object
def receive.
-
#multi_receive(events) ⇒ Object
def register.
-
#receive(event) ⇒ Object
def multi_receive.
- #register ⇒ Object
Methods included from Common
#log_dbg, #log_err, #log_info, #log_warn, #set_logger
Instance Attribute Details
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
113 114 115 |
# File 'lib/logstash/outputs/sumologic.rb', line 113 def stats @stats end |
Instance Method Details
#close ⇒ Object
def receive
164 165 166 167 168 169 |
# File 'lib/logstash/outputs/sumologic.rb', line 164 def close @monitor.stop() @piler.stop() @sender.stop() client.close() end |
#multi_receive(events) ⇒ Object
def register
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/logstash/outputs/sumologic.rb', line 132 def multi_receive(events) # events.map { |e| receive(e) } begin content = Array(events).map { |event| @builder.build(event) }.join($/) @queue.enq(content) @stats.record_multi_input(events.size, content.bytesize) rescue Exception => exception log_err( "Error when processing events", :events => events, :message => exception., :class => exception.class.name, :backtrace => exception.backtrace ) end end |
#receive(event) ⇒ Object
def multi_receive
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/logstash/outputs/sumologic.rb', line 149 def receive(event) begin content = @builder.build(event) @piler.input(content) rescue Exception => exception log_err( "Error when processing event", :event => event, :message => exception., :class => exception.class.name, :backtrace => exception.backtrace ) end end |
#register ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/logstash/outputs/sumologic.rb', line 115 def register set_logger(@logger) @stats = Statistics.new() @queue = MessageQueue.new(@stats, config) @builder = PayloadBuilder.new(@stats, config) @piler = Piler.new(@queue, @stats, config) @monitor = Monitor.new(@queue, @stats, config) @sender = Sender.new(client, @queue, @stats, config) if @sender.connect() @sender.start() @piler.start() @monitor.start() else throw "connection failed, please check the url and retry" end end |