Class: LogStash::Outputs::SumoLogic

Inherits:
Base
  • Object
show all
Includes:
Common, PluginMixins::HttpClient
Defined in:
lib/logstash/outputs/sumologic.rb,
lib/logstash/outputs/sumologic/batch.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: Batch, Compressor, HeaderBuilder, MessageQueue, Monitor, PayloadBuilder, Piler, Sender, Statistics

Constant Summary

Constants included from Common

Common::CARBON2, Common::CATEGORY_HEADER, Common::CATEGORY_HEADER_DEFAULT, Common::CATEGORY_HEADER_DEFAULT_STATS, Common::CLIENT_HEADER, Common::CLIENT_HEADER_VALUE, Common::CONTENT_ENCODING, Common::CONTENT_TYPE, Common::CONTENT_TYPE_CARBON2, Common::CONTENT_TYPE_GRAPHITE, Common::CONTENT_TYPE_LOG, Common::DEFAULT_LOG_FORMAT, Common::DEFLATE, Common::GRAPHITE, Common::GZIP, Common::HOST_HEADER, Common::LOG_TO_CONSOLE, Common::METRICS_NAME_PLACEHOLDER, Common::NAME_HEADER, Common::NAME_HEADER_DEFAULT, Common::STATS_TAG, Common::STOP_TAG

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#blank?, #log_dbg, #log_err, #log_info, #log_warn, #set_logger

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



119
120
121
# File 'lib/logstash/outputs/sumologic.rb', line 119

def stats
  @stats
end

Instance Method Details

#closeObject

def receive



153
154
155
156
157
158
# File 'lib/logstash/outputs/sumologic.rb', line 153

def close
  @monitor.stop()
  @piler.stop()
  @sender.stop()
  client.close()
end

#multi_receive(events) ⇒ Object

def register



137
138
139
# File 'lib/logstash/outputs/sumologic.rb', line 137

def multi_receive(events)
  Array(events).map { |event| receive(event) }
end

#receive(event) ⇒ Object

def multi_receive



141
142
143
144
145
146
147
148
149
150
151
# File 'lib/logstash/outputs/sumologic.rb', line 141

def receive(event)
  begin
    @piler.input(event)
  rescue Exception => exception
    log_err("error when processing event",
      :event => event,
      :message => exception.message,
      :class => exception.class.name,
      :backtrace => exception.backtrace)
  end
end

#registerObject



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/logstash/outputs/sumologic.rb', line 121

def register
  set_logger(@logger)
  @stats = Statistics.new
  @queue = MessageQueue.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