Class: LogStash::Outputs::MonascaLogApi

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/monasca_log_api.rb

Overview

This Logstash Output plugin, sends events to monasca-api. It authenticates against keystone and gets a token. The token is used to authenticate against the monasca-api and send log events.

Constant Summary collapse

JSON_LOGS =
'logs'
JSON_DIMS =
'dimensions'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logsObject

Returns the value of attribute logs.



54
55
56
# File 'lib/logstash/outputs/monasca_log_api.rb', line 54

def logs
  @logs
end

#start_timeObject

Returns the value of attribute start_time.



54
55
56
# File 'lib/logstash/outputs/monasca_log_api.rb', line 54

def start_time
  @start_time
end

#time_threadObject

Returns the value of attribute time_thread.



54
55
56
# File 'lib/logstash/outputs/monasca_log_api.rb', line 54

def time_thread
  @time_thread
end

Instance Method Details

#closeObject



82
83
84
# File 'lib/logstash/outputs/monasca_log_api.rb', line 82

def close
  stop_time_check
end

#multi_receive(events) ⇒ Object



75
76
77
78
79
80
# File 'lib/logstash/outputs/monasca_log_api.rb', line 75

def multi_receive(events)
  @logger.debug("Retrieving #{events.size} events")
  events.each do |event|
    encode(event)
  end
end

#registerObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/logstash/outputs/monasca_log_api.rb', line 62

def register
  @mutex = Mutex.new
  @logger.info('Registering keystone user',
    :username => username, :project_name => project_name)
  @monasca_log_api_client = LogStash::Outputs::Monasca::MonascaLogApiClient
    .new monasca_log_api, monasca_log_api_version
  @logs = Hash.new
  @start_time = nil
  init_token
  initialize_logs_object
  start_time_check
end