removido
(usa Nenhuma)
Enviado em 17/10/2016 - 12:11h
Faz o seguinte:
# vim /etc/rsyslog.d/history.conf
local3.* /var/log/history.log
Adicione no final do arquivo bashrc:
# vim /etc/bashrc
whoami="$(whoami)@$(echo $SSH_CONNECTION | awk '{print $1}')"
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local3.debug "$whoami [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'
# vim /etc/logrotate.d/history
/var/log/history.log {
missingok
notifempty
compress
weekly
create 640 root root
}
Ex. de saída:
# tailf /var/log/history.log
Oct 17 11:59:25 nabucodonosor amarildo: amarildo@192.168.25.9 [3832]: sudo -i [0]
Oct 17 11:59:39 nabucodonosor amarildo: root@ [3877]: vim /etc/bashrc [0]
Oct 17 12:18:28 nabucodonosor amarildo: root@ [8033]: su - teste [0]
Oct 17 12:18:28 nabucodonosor amarildo: teste@ [8156]: tailf /var/log/httpd/error.log [130]