Created
January 21, 2020 14:38
-
-
Save ckxng/8a34fe6ce94833af76e411567005c3df to your computer and use it in GitHub Desktop.
log user commands
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
function log2syslog | |
{ | |
declare COMMAND | |
COMMAND=$(fc -ln -0) | |
TTY=$(tty) | |
TTYOWNER=$(stat -c ‘%U’ ${TTY}) | |
logger -p local1.notice -t bash -i -- “${TTY}:${TTYOWNER}:${USER}:${COMMAND}" | |
} | |
trap log2syslog DEBUG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment