SoarAuditingFormatter

This gem provides the formatting of audit entries for auditing purposes.

Installation

Add this line to your auditor Gemfile:

gem 'soar_auditing_format'

And then execute:

$ bundle

Or install it yourself as:

$ gem install soar_auditing_format

Testing

Behavioural driven testing can be performed:

$ bundle exec rspec -cfd spec/*

Usage

When formatting an auditing entry call the formatter as follow:

SoarAuditingFormatter::Formatter.format(:error,SecureRandom.hex(32),Time.now,"message")

When formatting an optional field call the formatter as follow:

SoarAuditingFormatter::Formatter.optional_field_format("somekey", "somevalue")

Detailed example

require 'soar_auditing_format'
require 'byebug'
require 'securerandom'

class Main
  def test_sanity
    my_optional_field = SoarAuditingFormatter::Formatter.optional_field_format("somekey", "somevalue")
    puts SoarAuditingFormatter::Formatter.format(:error,SecureRandom.hex(32),Time.now.utc.iso8601(3),"#{my_optional_field} message")
  end
end

main = Main.new
main.test_sanity

The formatted output of the example above will be something like this:

error,9241cee6f0368942202d4d0e22ac09cde6c88446137c8c48e4eb053a703855f8,2016-05-27T08:40:27.087Z,[somekey:somevalue] message

Contributing

Bug reports and feature requests are welcome by email to barney dot de dot villiers at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)

Notes

Though out of scope for the provider, auditors should take into account encoding, serialization, and other NFRs.

License

The gem is available as open source under the terms of the MIT License.