vi /etc/profile
PROMPT_COMMAND='history -a >(tee -a ~/.bash_history | logger -p local2.notice -t "$USER[$$]")'

vi /etc/syslog.conf
local2.notice                                                   /var/log/history.log

vi /etc/logrotate.conf
/var/log/history.log {
    daily
    rotate 100
}

重啟syslog
/etc/init.d/syslog restart

logrotate每天會排程執行,如果要手動執行的話
logrotate -d -f /etc/logrotate.conf

arrow
arrow
    文章標籤
    unix linux syslog
    全站熱搜

    helloworld 發表在 痞客邦 留言(0) 人氣()