Skip to content

Instantly share code, notes, and snippets.

@rkoster
Forked from yudai/gist:7540823
Last active December 28, 2015 18:49
Show Gist options
  • Save rkoster/7546242 to your computer and use it in GitHub Desktop.
Save rkoster/7546242 to your computer and use it in GitHub Desktop.
module Bosh::OpenStackCloud
class ExconLoggingInstrumentor
REDACTED = "[REDACTED]"
def self.instrument(name, params = {}, &block)
params = params.dup
if params.has_key?(:headers) && params[:headers].has_key?('Authorization')
params[:headers] = params[:headers].dup
params[:headers]['Authorization'] = REDACTED
end
if params.has_key?(:password)
params[:password] = REDACTED
end
Bosh::Clouds::Config.logger.debug("#{name} #{params.inspect}")
if block_given?
yield
end
end
end
end
# And add this value to openstack_params
# at https://github.com/cloudfoundry/bosh/blob/master/bosh_openstack_cpi/lib/cloud/openstack/cloud.rb#L45
# and https://github.com/cloudfoundry/bosh/blob/master/bosh_openstack_cpi/lib/cloud/openstack/cloud.rb#L61
:connection_options => {:instrumentor => Bosh::OpenStackCloud::ExconLoggingInstrumentor}
# Also make sure to require the above file
# at https://github.com/cloudfoundry/bosh/blob/master/bosh_openstack_cpi/lib/cloud/openstack.rb#L33
require "cloud/openstack/excon_logging_instrumentor"
# After restarting the director (when inline editing), the log can be viewed by:
# bosh task {task_id} --debug | grep excon\\.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment