Class: ManageIQ::Loggers::CloudWatch
- Defined in:
- lib/manageiq/loggers/cloud_watch.rb
Constant Summary collapse
- NAMESPACE_FILE =
"/var/run/secrets/kubernetes.io/serviceaccount/namespace".freeze
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(logdev, *args) ⇒ CloudWatch
constructor
A new instance of CloudWatch.
Methods inherited from Base
#level, #log_backtrace, log_hashes, #log_hashes, log_hashes_filter, #log_hashes_filter, log_hashes_filter=, #log_hashes_filter=, #silence
Constructor Details
Class Method Details
.new(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/manageiq/loggers/cloud_watch.rb', line 10 def self.new(*args) access_key_id = ENV["CW_AWS_ACCESS_KEY_ID"].presence secret_access_key = ENV["CW_AWS_SECRET_ACCESS_KEY"].presence log_group_name = ENV["CLOUD_WATCH_LOG_GROUP"].presence log_stream_name = ENV["HOSTNAME"].presence container_logger = ManageIQ::Loggers::Container.new return container_logger unless access_key_id && secret_access_key && log_group_name && log_stream_name require 'cloudwatchlogger' creds = {:access_key_id => access_key_id, :secret_access_key => secret_access_key} cloud_watch_logdev = CloudWatchLogger::Client.new(creds, log_group_name, log_stream_name) super(cloud_watch_logdev).tap { |logger| logger.extend(ActiveSupport::Logger.broadcast(container_logger)) } end |