# see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # uncomment this if you want your log files compressed #compress # use date as a suffix of the rotated filedateext # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp -- we'll rotate them here /var/log/wtmp { monthly minsize 1M create 0664 root utmp rotate 1 }
#示例1.在/var/log中创建并写入日志信息由syslog协议处理的,是由守护进程sylogd负责执行,每个标准进程都可以用syslog记录日志,可以使用logger命令通过syslogd记录日志 logger "This is a test logger" [root@izwz9biz2m4sd3bb3k38pgz ~]# tail -n 1 /var/log/messages Jun 6 09:41:03 izwz9biz2m4sd3bb3k38pgz root: This is a test logger
#示例2.如果要记录特定的标记(tag)可以使用: logger -t FLAG-TAG "This is a test logger demo 2" [root@izwz9biz2m4sd3bb3k38pgz ~]# tail -n 1 /var/log/messages Jun 6 09:42:09 izwz9biz2m4sd3bb3k38pgz FLAG-TAG: This is a test logger demo 2
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!