Due to auditing policies ( auditd.log is monitored), I have to send alert messages from my adhoc check scripts to auditd.log.
Any idea what is best / standard solution ?
I think that echo log >> auditd.log
is not good idea.
E.g. I have this check script for checking valid home directories
awk -F: '$3 >= 1000 {print $1, $6 }' /etc/passwd |
while read -r user directory; do
if [ ! -d "$directory" ]; then
echo "Found invalid directories $user"
fi
done |
# If no output, print default message
grep '^' >&2 || echo "No invalid directories" >&2
As I understood auditd.log has some standard format: e.g.
type=SERVICE_START msg=audit(1621698670.030:74): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=kdump comm="systemd" exe="/usr/lib/sys
temd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset"