custom log format
The audit logger supports custom log formatting. The field names are fixed, but other than that, you can go crazy with your own format.
Available fields:
timestampusernamegroupuidguidauideuidegidpidppidttycommandexec_pathscriptcwdenvargs
good to know
args is always mapped to a ["string", | ["string"] ] format, where the first element is always the command itself.
e.g. in case of ls -la, ${command} will be /bin/ls, while ${args} will be ["ls", "-G", "-la"] (ls is aliased to ls -G)
Example configuration #1
yaml
auditLogger:
customLogFormat: "[${timestamp}]: (${username}, ${group}) |example text| ${command} % ${args}"
# Rest of the configuration file is omittedExample command:
bash
ls -lawould result in the following log line:
[2023-10-03T20:03:03.696Z]: (administrator, staff) |example text| /bin/ls % ["ls", "-G", "-la"]Example configuration #2
yaml
auditLogger:
customLogFormat: "/${timestamp}/: ${command} executed with (${args}) arguments"
# Rest of the configuration file is omittedExample command:
bash
brew --versionwould result in the following log line:
/2023-10-03T20:03:03.696Z/: /bin/bash executed with (["/bin/bash", "/usr/local/bin/brew", "--version"]) argumentsExample configuration #3
yaml
auditLogger:
customLogFormat: "${username} run ${command}"
# Rest of the configuration file is omittedExample command:
bash
date +%swould result in the following log line:
administrator run /bin/date