Sha256: 3ca902d30adc85c0a399ca2b207c4025e088513b371707c5ed01a6d5bbf1376a

Contents?: true

Size: 909 Bytes

Versions: 27

Compression:

Stored size: 909 Bytes

Contents

module MCollective
  module RPC
    # An audit plugin that just logs to a file
    #
    # You can configure which file it logs to with the setting
    #
    #   plugin.rpcaudit.logfile

    class Logfile<Audit
      require 'pp'

      def audit_request(request, connection)
        logfile = Config.instance.pluginconf["rpcaudit.logfile"] || "/var/log/mcollective-audit.log"

        now = Time.now
        # Already told timezone to be in UTC so we don't look it up again
        # This avoids platform specific timezone representation issues
        now_iso8601 = now.utc.strftime("%Y-%m-%d %H:%M:%S UTC")

        File.open(logfile, "a") do |f|
          f.puts("[#{now_iso8601}] reqid=#{request.uniqid}: reqtime=#{request.time} caller=#{request.caller}@#{request.sender} agent=#{request.agent} action=#{request.action} data=#{request.data.pretty_print_inspect}")
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mcollective-client-2.10.6 lib/mcollective/audit/logfile.rb
mcollective-client-2.10.4 lib/mcollective/audit/logfile.rb
mcollective-client-2.10.3 lib/mcollective/audit/logfile.rb
mcollective-client-2.10.2 lib/mcollective/audit/logfile.rb
mcollective-client-2.10.1 lib/mcollective/audit/logfile.rb
mcollective-client-2.10.0 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.7 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.5 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.8 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.6 lib/mcollective/audit/logfile.rb
mcollective-client-2.9.1 lib/mcollective/audit/logfile.rb
mcollective-client-2.9.0 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.9 lib/mcollective/audit/logfile.rb
dtk-node-agent-0.7.7 mcollective_additions/plugins/v2.2/audit/logfile.rb
dtk-node-agent-0.7.6 mcollective_additions/plugins/v2.2/audit/logfile.rb
dtk-node-agent-0.7.5 mcollective_additions/plugins/v2.2/audit/logfile.rb
mcollective-client-2.8.4 lib/mcollective/audit/logfile.rb
mcollective-client-2.8.3 lib/mcollective/audit/logfile.rb
dtk-node-agent-0.7.4.1 mcollective_additions/plugins/v2.2/audit/logfile.rb
dtk-node-agent-0.7.4 mcollective_additions/plugins/v2.2/audit/logfile.rb