Class: LogstashAuditor::LogstashAuditor

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash_auditor/auditor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogstashAuditor

Returns a new instance of LogstashAuditor.



10
11
12
# File 'lib/logstash_auditor/auditor.rb', line 10

def initialize
  @has_been_configured = false
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



8
9
10
# File 'lib/logstash_auditor/auditor.rb', line 8

def configuration
  @configuration
end

#has_been_configuredObject (readonly)

Returns the value of attribute has_been_configured.



7
8
9
# File 'lib/logstash_auditor/auditor.rb', line 7

def has_been_configured
  @has_been_configured
end

Instance Method Details

#<<(data) ⇒ Object



42
43
44
# File 'lib/logstash_auditor/auditor.rb', line 42

def <<(data)
  event(data)
end

#configure(configuration = nil) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
# File 'lib/logstash_auditor/auditor.rb', line 14

def configure(configuration = nil)
  raise ArgumentError, "No configuration provided" if configuration == nil
  raise ArgumentError, "Invalid configuration provided" unless configuration_is_good(configuration)

  @configuration = configuration
  @has_been_configured = true
end

#debug(data) ⇒ Object



22
23
24
# File 'lib/logstash_auditor/auditor.rb', line 22

def debug(data)
  event(data)
end

#error(data) ⇒ Object



30
31
32
# File 'lib/logstash_auditor/auditor.rb', line 30

def error(data)
  event(data)
end

#event(data) ⇒ Object



46
47
48
49
# File 'lib/logstash_auditor/auditor.rb', line 46

def event(data)
  data = { "message" => data }
  send_event( data )
end

#fatal(data) ⇒ Object



38
39
40
# File 'lib/logstash_auditor/auditor.rb', line 38

def fatal(data)
  event(data)
end

#info(data) ⇒ Object



26
27
28
# File 'lib/logstash_auditor/auditor.rb', line 26

def info(data)
  event(data)
end

#warn(data) ⇒ Object



34
35
36
# File 'lib/logstash_auditor/auditor.rb', line 34

def warn(data)
  event(data)
end