rsyslog local0-local7的用法
很多时候我们需要将一个服务的日志文件导向一个指定的文件,这个时候可以设置log-facility 如在dhcpd.conf中配置
1 : update log-facility in the dhcpd.conf file
[root@lab ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
# dhcpd.conf
# #
log-facility local2;
default-lease-time 600;
max-lease-time 7200;
#
# # If this DHCP server is the official DHCP server for the local
# # network, the authoritative directive should be uncommented.
authoritative;
#
#
allow booting;
allow bootp;
ddns-update-style interim;
#
# # Standard configuration directives...
#
subnet 192.168.0.0 netmask 255.255.255.0 {
next-server 192.168.0.254;
option routers 192.168.0.254;
range 192.168.0.200 192.168.0.240;
# option domain-name-servers 9.186.182.1;
filename "pxelinux.0";
}
2: update /etc/rsyslog.conf file
# Save boot messages also to boot.log
local7.* /var/log/boot.log
local2.* /var/log/dhcpd.log
问题是重启上面两个服务器,注意先让rsyslog生效再重启dhcp服务
发现/var/log/message 和dhcpd.log中都会生成日志
最新文章
- webpack进阶构建项目(一)
- poj 1326
- ImportError: No module named MySQLdb
- 10 notorious computer virus
- 单调递增最长子序列(南阳理工ACM)
- Android 最火的快速开发框架XUtils
- Spyder调试错误-";TypeError: decoding Unicode is not supported";
- 为何要fork()两次来避免产生僵尸进程?
- 解决WebSocket兼容ie浏览器版本问题
- Error: expected expression, got '}'
- 如何查杀stopped进程
- Xshell5 提示要继续使用此程序,您必须应用最新的更新或使用新版本
- H/s:哈希率单位转换
- Java之使用HttpClient发送GET请求
- html:块级元素和行内元素的特点
- 在net中json序列化与反序列化
- composer - No business network has been specified for this connection 解决方案
- 未能加载“xxx”程序集
- Challenge 18
- 在python中使用静态方法staticmethod