lib/contrast/components/security_logger.rb in contrast-agent-7.3.2 vs lib/contrast/components/security_logger.rb in contrast-agent-7.4.0

- old
+ new

@@ -8,10 +8,11 @@ module SecurityLogger # Here we will read and store the setting for the CEF Logging functionality class Interface include Contrast::Components::ComponentBase + DEFAULT_CEF_NAME = 'security.log' CANON_NAME = 'agent.security_logger' CONFIG_VALUES = %w[path level].cs__freeze # @return [String, nil] attr_accessor :path @@ -27,9 +28,25 @@ @canon_name = CANON_NAME return unless hsh @path = hsh[:path] @level = hsh[:level] + end + + def to_effective_config effective_config + path_setting = nil + level_setting = nil + + if defined?(Contrast::SETTINGS) + path_setting = Contrast::SETTINGS.agent_state.cef_logger_path + level_setting = Contrast::SETTINGS.agent_state.cef_logger_level + end + + path_setting ||= DEFAULT_CEF_NAME + level_setting ||= Contrast::CONFIG.agent.logger.level + + add_single_effective_value(effective_config, config_values[0], path || path_setting, CANON_NAME) + add_single_effective_value(effective_config, config_values[1], level || level_setting, CANON_NAME) end end end end end