Skip to content

Instantly share code, notes, and snippets.

@santaklouse
Created April 12, 2024 12:40
Show Gist options
  • Save santaklouse/c6f4ed6c1855c6805967787f709e8c3c to your computer and use it in GitHub Desktop.
Save santaklouse/c6f4ed6c1855c6805967787f709e8c3c to your computer and use it in GitHub Desktop.
logs user input to log (add to /etc/bash.bashrc)
function log2syslog
{
declare COMMAND
COMMAND=$(fc -ln -0)
logger -p local1.notice -t bash -i -- "${USER}:${SUDO_USER}:${COMMAND}"
}
trap log2syslog DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment