First, modify the hostname Color:
# root @ k8s-node05 cat /etc/profile
In the end of the file add:
# for bash_color
PS1="\e[33;36m#\e[0m \e[31;40m\u\e[0m @ \e[32;40m\h\e[0m\] in \e[33;40m\w\e[0m\n$ "
# root @ k8s-node05 source /etc/profile
Second, increase the recording operation history:
# root @ k8s-node05 cat /etc/bashrc
In the end of the file add:
# for bash_history
export PROMPT_COMMAND=\
'{ msg=$(history 1 | { read x y ; echo $y ;});\
logger -t bash_history "[euid=$(whoami)]":$(who am i):[`pwd`]" $msg";}'
# root @ k8s-node05 source /etc/bashrc
All actions will be recorded to a file
# root @ k8s-node05 tail -f /var/log/messages
bash_history: [euid = root]: root pts / 0 2019-08-08 18:10 (10.212.134.201): [/ var / log] cat / etc / bashrc
It may be incorporated into the logs es es