Class: Fluent::LogitOutput

Inherits:
BufferedOutput
  • Object
show all
Defined in:
lib/fluent/plugin/out_logit.rb

Instance Method Summary collapse

Constructor Details

#initializeLogitOutput

Returns a new instance of LogitOutput.



9
10
11
12
13
14
# File 'lib/fluent/plugin/out_logit.rb', line 9

def initialize
  super
  require 'socket'
  require 'timeout'
  require 'fileutils'
end

Instance Method Details

#configure(conf) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fluent/plugin/out_logit.rb', line 29

def configure(conf)
  super
  if /[\w]{8}(-[\w]{4}){3}-[\w]{12}/.match(@stack_id) == nil
    raise "stack_id is required and must be a GUID. See the source wizard"
  end
  if @port == 0
    raise "port is required. See the source wizard."
  end

  if @tls_mode == :mutual
    if ! @tls_ca_certificate || @tls_ca_certificate.empty?
      raise Fluent::ConfigError, 
        "tls_ca_certificate is required when tls_mode is set to mutual"
    end

    if ! @tls_certificate || @tls_certificate.empty?
      raise Fluent::ConfigError,
        "tls_certificate is required when tls_mode is set to mutual"
    end

    if ! @tls_private_key || @tls_private_key.empty?
      raise Fluent::ConfigError,
        "tls_private_key is required when tls_mode is set to mutual"
    end
  end
end

#format(tag, time, record) ⇒ Object



64
65
66
# File 'lib/fluent/plugin/out_logit.rb', line 64

def format(tag, time, record)
  [tag, time, record].to_msgpack
end

#shutdownObject



60
61
62
# File 'lib/fluent/plugin/out_logit.rb', line 60

def shutdown
  super
end

#startObject



56
57
58
# File 'lib/fluent/plugin/out_logit.rb', line 56

def start
  super
end

#write(chunk) ⇒ Object



68
69
70
71
72
# File 'lib/fluent/plugin/out_logit.rb', line 68

def write(chunk)
  return if chunk.empty?

  send_data(chunk)
end