Skip to content

Commit

Permalink
[Bug 12062] - Obscuring plugin details
Browse files Browse the repository at this point in the history
- overridden two methods that were producing config
options to be printed in logs

Change-Id: I1ce3cdf7d80e62c8c1da21fc46679e6a91ae49f6
  • Loading branch information
Tomasz Trębski committed Sep 21, 2015
1 parent 04ef470 commit 64d3d8f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
35 changes: 29 additions & 6 deletions lib/logstash/outputs/monasca_log_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,42 @@ def receive(event)
@codec.encode(event)
end # def receive

def finished
if @shutdown_queue
@logger.info('Sending shutdown event to agent queue', :plugin => self.class.config_name)
@shutdown_queue << self
end
if @plugin_state != :finished
@logger.info('Plugin is finished', :plugin => self.class.config_name)
@plugin_state = :finished
end
end

def shutdown(queue)
teardown
@logger.info('Received shutdown signal', :plugin => self.class.config_name)

@shutdown_queue = queue
if @plugin_state == :finished
finished
else
@plugin_state = :terminating
end
end

private
def check_token
now = DateTime.now + Rational(1, 1440)
if now >= @token.expire_at
@token = get_token
@logger.info("Token expired. New token requested")
@logger.info('Token expired. New token requested')
end
end

private
def send_event(event, data, dimensions)
@monasca_log_api_client.send_event(event, data, @token.id, dimensions, get_application_type(event)) if event and @token.id and data
end

def get_application_type(event)

# support for nested.keys.with.lists.0
Expand All @@ -100,11 +126,8 @@ def get_application_type(event)
app_type
end

def send_event(event, data, dimensions)
@monasca_log_api_client.send_event(event, data, @token.id, dimensions, get_application_type(event)) if event and @token.id and data
end

def get_token
@keystone_client.authenticate(domain_id, username, password, project_name)
end

end # class LogStash::Outputs::Example
5 changes: 3 additions & 2 deletions logstash-output-monasca_log_api.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Gem::Specification.new do |s|
s.name = 'logstash-output-monasca_log_api'
s.version = '0.3'
s.version = '0.3.1'
s.licenses = ['Apache License 2.0']
s.summary = 'This gem is a logstash output plugin to connect via http to monasca-log-api.'
s.description = 'This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program'
s.authors = ['Fujitsu Enabling Software Technology GmbH']
s.email = '[email protected]'
s.email = '[email protected],[email protected]'
s.require_paths = ['lib']
s.homepage = 'https://github.com/FujitsuEnablingSoftwareTechnologyGmbH/logstash-output-monasca_api'

# Files
s.files = `git ls-files`.split($\)
Expand Down

0 comments on commit 64d3d8f

Please sign in to comment.