• 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中都会生成日志

  • 相关阅读:
    ios添加pre和post build action
    Highcharts将数据以图表的形式展现
    【deep learning学习笔记】注释yusugomori的LR代码 --- 模型测试
    九乘九口诀算法
    JMS学习的个人理解笔记
    php与文件操作
    java 泛型
    约定
    写给自己,毕业三年,薪水涨了12倍,你信吗
    好技术领导和差技术领导区别在哪里--转
  • 原文地址:https://www.cnblogs.com/lpfuture/p/5886206.html
Copyright © 2020-2023  润新知