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::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

#log_dbg, #log_err, #log_info, #log_warn, #set_logger

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



117
118
119
# File 'lib/logstash/outputs/sumologic.rb', line 117

def stats
  @stats
end

Instance Method Details

#closeObject

def receive



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

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

#multi_receive(events) ⇒ Object

def register



135
136
137
# File 'lib/logstash/outputs/sumologic.rb', line 135

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

#receive(event) ⇒ Object

def multi_receive



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

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



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

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