很多时候我们需要将一个服务的日志文件导向一个指定的文件,这个时候可以设置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中都会生成日志

最新文章

  1. webpack进阶构建项目(一)
  2. poj 1326
  3. ImportError: No module named MySQLdb
  4. 10 notorious computer virus
  5. 单调递增最长子序列(南阳理工ACM)
  6. Android 最火的快速开发框架XUtils
  7. Spyder调试错误-"TypeError: decoding Unicode is not supported"
  8. 为何要fork()两次来避免产生僵尸进程?
  9. 解决WebSocket兼容ie浏览器版本问题
  10. Error: expected expression, got '}'
  11. 如何查杀stopped进程
  12. Xshell5 提示要继续使用此程序,您必须应用最新的更新或使用新版本
  13. H/s:哈希率单位转换
  14. Java之使用HttpClient发送GET请求
  15. html:块级元素和行内元素的特点
  16. 在net中json序列化与反序列化
  17. composer - No business network has been specified for this connection 解决方案
  18. 未能加载“xxx”程序集
  19. Challenge 18
  20. 在python中使用静态方法staticmethod

热门文章

  1. qq划屏幕红包程序
  2. Thinkphp5笔记九:路由设置,隐藏indx.php
  3. SharePoint 2013 页面中window/document.onload/ready 事件不能触发的解决方案
  4. windows上完美的X-server服务器软件:MobaXterm
  5. proto序列化
  6. ubuntu 的chmod 和 chown
  7. 使用 Python 解数学方程
  8. [转] 关于QT的系统总结
  9. classpath路劲
  10. 源码分析三(Vector与ArrayList的区别)