Method: NewRelic::Agent::AuditLogger#ensure_log_path

Defined in:
lib/new_relic/agent/audit_logger.rb

#ensure_log_pathObject


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/new_relic/agent/audit_logger.rb', line 81

def ensure_log_path
  path = File.expand_path(NewRelic::Agent.config[:'audit_log.path'])
  log_dir = File.dirname(path)

  begin
    FileUtils.mkdir_p(log_dir)
    FileUtils.touch(path)
  rescue SystemCallError => e
    msg = "Audit log disabled, failed opening log at '#{path}': #{e}"
    ::NewRelic::Agent.logger.warn(msg)
    path = nil
  end

  path
end