sudo export HISTCONTROL=""
sudo -e /etc/bashrc //add the following line to the end of the file
export PROMPT_COMMAND='command_status=$?; command_path=$PWD; last_command=$(history -a >(tee -a $HISTFILE)); if [[ -n "$last_command" ]]; then logger -p local6.debug "$(whoami) [$$]: Path = $command_path commandLine = $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) commandStatus=$command_status"; history -c; history -r; fi'
source /etc/bashrc
sudo -e /etc/rsyslog.d/bash.conf //add the following line to the beginning of the file
local6.* /var/log/commands.log
sudo -e /etc/logrotate.d/syslog //add the following line to the beginning of the file
/var/log/commands.log
sudo vi /etc/rsyslog.conf //add the following line to the end of the file
local6.* @@{destinationIP}:{destinationPort}
sudo service rsyslog restart
Note ==> @@ : tcp | @ : udp
sudo export HISTCONTROL=""
sudo -e /etc/bashrc //add the following line to the end of the file
export PROMPT_COMMAND='command_status=$?; command_path=$PWD; last_command=$(history -a >(tee -a $HISTFILE)); if [[ -n "$last_command" ]]; then logger -p local6.debug "$(whoami) [$$]: Path = $command_path commandLine = $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) commandStatus=$command_status"; history -c; history -r; fi'
source /etc/bash.bashrc
sudo -e /etc/rsyslog.d/bash.conf //add the following line to the beginning of the file
local6.* /var/log/commands.log
sudo -e /etc/logrotate.d/rsyslog //add the following line to the beginning of the file
/var/log/commands.log
sudo vi /etc/rsyslog.conf //add the following line to the end of the file
local6.* @@{destinationIP}:{destinationPort}
sudo service rsyslog restart
Note ==> @@ : tcp | @ : udp