Class: LogStash::Outputs::Seq

Inherits:
Base
  • Object
show all
Includes:
PluginMixins::HttpClient
Defined in:
lib/logstash/outputs/seq.rb

Overview

An output that sends events to Seq.

Constant Summary collapse

@@ignore_properties =
{
    '@timestamp' => true,
    '@level' => true,
    '@version' => true,
    'message' => true
}

Instance Method Summary collapse

Instance Method Details

#multi_receive(events) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/logstash/outputs/seq.rb', line 48

def multi_receive(events)
  payload = {
      'Events' => events.map {|event| to_seq_payload(event)}
  }
  post_to_seq(payload)

  "#{events.length} events received"
end

#receive(event) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/logstash/outputs/seq.rb', line 58

def receive(event)
  payload = {
      'Events' => [to_seq_payload(event)]
  }
  post_to_seq(payload)

  'Event received'
end

#registerObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/logstash/outputs/seq.rb', line 28

def register
  url = @url

  url += '/' unless url.end_with? '/'
  url += 'api/events/raw'

  @url = url

  @default_headers = {
      'X-Seq-ApiKey' => @api_key,
      'Content-Type' => 'application/json'
  }

  # We count outstanding requests with this queue; it tracks outstanding requests to create backpressure
  # When this queue is empty no new requests may be sent, tokens must be added back by the client on success
  @request_tokens = SizedQueue.new(@pool_max)
  @pool_max.times {|t| @request_tokens << true }
end