zoukankan      html  css  js  c++  java
  • 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中都会生成日志

  • 相关阅读:
    Learning_the_bash_Shell_Third_Edition 15/n
    Learning_the_bash_Shell_Third_Edition 14/n
    Learning_the_bash_Shell_Third_Edition 13/n
    cvb源码分析,resful规范,drf,drf序列化组件,95
    rest_framework登录组件,权限组件
    forms组件
    分页器
    基于ajax提交数据
    回顾django内容
    多表操作
  • 原文地址:https://www.cnblogs.com/lpfuture/p/5886206.html
Copyright © 2011-2022 走看看