echo "Defaults logfile = /var/log/sudo.log" >> /etc/sudoers # sudoer
visudo -c # 因为不是用visudo的,所以要检查语法
echo "local2.debug /var/log/sudo.log">>/etc/rsyslog.conf # rsyslog
systemctl restart rsyslog # 重启rsyslog服务,从而使得配置文件生效
# 后面只要用户操作sudo,我们就能在/var/log/sudo.log中查看到了