#vi /etc/profile
function history_to_syslog {
declare CMD
CMD=$(history 1)
USER=`who am i`' : '$LOGNAME
logger -p local6.notice -- SESSION = $$, WHO = $USER, CMD = $CMD
}
trap history_to_syslog DEBUG
#vi /etc/rsyslog.conf
local6.notice /var/log/history_cmd.log
#systemctl restart rsyslog
#vi /etc/logrotate.d/history_cmd
/vat/log/history_cmd.log
{
monthly
rotate 12
missingok
notifempty
create
postrotate
systemctl restart rsyslog
endscript
}
#logrotate -f /etc/logrotate.d/history_cmd
'linux > Tip' 카테고리의 다른 글
cr/lf 변환 (0) | 2022.05.12 |
---|---|
쉘 스크립트 수행시 다음 오류 발생 (^M: bad interpreter: no such file or directory) (0) | 2017.01.24 |
SSH Tunneling을 이용한 방화벽 우회 (0) | 2007.11.27 |
rc.local 에 특정유저로 작업 시작하기 (0) | 2007.11.19 |
putty saved session 을 REG 으로 만들기. (0) | 2007.10.30 |