1) vim /etc/bash.bashrc
Append to the end of that file:
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'
2) Set up logging for "local6" with a new file:
vim /etc/rsyslog.d/bash.conf
And the contents...
local6.* /var/log/commands.log
3) Restart rsyslog:
sudo service rsyslog restart