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, #wrap, wrap
Constructor Details
Class Method Details
.new(*args, access_key_id: nil, secret_access_key: nil, log_group: nil, log_stream: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/manageiq/loggers/cloud_watch.rb', line 10 def self.new(*args, access_key_id: nil, secret_access_key: nil, log_group: nil, log_stream: nil) access_key_id ||= ENV["CW_AWS_ACCESS_KEY_ID"].presence secret_access_key ||= ENV["CW_AWS_SECRET_ACCESS_KEY"].presence log_group ||= ENV["CLOUD_WATCH_LOG_GROUP"].presence log_stream ||= ENV["HOSTNAME"].presence container_logger = ManageIQ::Loggers::Container.new return container_logger unless access_key_id && secret_access_key && log_group && log_stream require 'cloudwatchlogger' creds = {:access_key_id => access_key_id, :secret_access_key => secret_access_key} cloud_watch_logdev = CloudWatchLogger::Client.new(creds, log_group, log_stream) cloud_watch_logger = super(cloud_watch_logdev) cloud_watch_logger.wrap(container_logger) end |