-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate audit log functionality - initial commit
Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
- Loading branch information
Showing
3 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Train | ||
class AuditLog | ||
# TODO: | ||
# Configurable values log location, log file size, log frequency((available options, daily, weeks, monthly)) | ||
|
||
# Default values for audit log options are set in the options.rb | ||
def self.create(options = {}) | ||
logger = Logger.new(options[:audit_log_location], options[:audit_log_frequency], options[:audit_log_size]) | ||
logger.level = options[:level] || Logger::INFO | ||
logger.progname = options[:audi_log_app_name] | ||
logger.datetime_format = "%Y-%m-%d %H:%M:%S" | ||
logger.formatter = proc do |severity, datetime, progname, msg| | ||
{ | ||
level: severity, | ||
timestamp: datetime.to_s, | ||
app: progname, | ||
type: msg[:type], | ||
command: msg[:command], | ||
path: msg[:path], | ||
source: msg[:source], | ||
destination: msg[:destination], | ||
hostname: msg[:hostname], | ||
user: msg[:user], | ||
}.compact.to_json + $/ | ||
end | ||
logger | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters