Skip to content

Instantly share code, notes, and snippets.

@mralexjuarez
Last active September 30, 2017 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mralexjuarez/2f84fe915cf26904880bcad9a0afb79d to your computer and use it in GitHub Desktop.
Save mralexjuarez/2f84fe915cf26904880bcad9a0afb79d to your computer and use it in GitHub Desktop.
## Place the following in to ~/.bashrc
w4hoami="$(whoami)@$(echo $SSH_CONNECTION | awk '{print $1}')"export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$whoami [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'
## Place the following under /etc/rsyslog.d/bash.conf
local6.* /var/log/commands.log # Log commands to /var/log/commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment