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

rsyslog local0-local7的用法的更多相关文章

  1. syslog之二:syslog协议及rsyslog服务全解析

    目录: <syslog之一:Linux syslog日志系统详解> <syslog之二:syslog协议及rsyslog服务全解析> <syslog之三:建立Window ...

  2. CentOS配置rsyslog Serve

    CentOS6配置rsyslog Server: vi /etc/rsyslog.conf: #启用如下tcp支持: $ModLoad imtcp $InputTCPServerRun 514 #添加 ...

  3. rsyslog日志服务的配置文件分析

    基于rsyslog日志服务的日志 在不同的LINUX系统,实现的软件略有不同. syslog,rsyslog,syslog-ng,用于实现系统日志的管理. [root@asianux4 ~]# rpm ...

  4. RSYSLOG没那么简单

    定义系统默认的日志收集还算EASY. 但如何在公司项目里要配置程序员们写的自定义日志,那可能就要用到LOCAL及FILTER过滤这些东东了... 慢慢走吧.. 收集URL备用,都是讲LOCAL,TEM ...

  5. Linux学习-rsyslog.service :记录登录文件的服务

    rsyslog.service 的配置文件:/etc/rsyslog.conf 我们现在知道 rsyslogd 可以负责主机产生的各个信息的登录,而这些信息本身是有『严重等级』之分的, 而且, 这些资 ...

  6. syslog,rsyslog and syslog-ng

    http://en.wikipedia.org/wiki/Syslog Syslog is a standard for computer message logging. It permits se ...

  7. Linux日志系统分析:rsyslog、syslog和klog

    参考博客: https://blog.csdn.net/lidonghat/article/details/55004280 https://blog.csdn.net/u012247418/arti ...

  8. 001-CentOS 7系统搭建Rsyslog+LogAnalyzer解决交换机日志收

    日志功能对于操作系统是相当重要的,在使用中,无论是系统还是应用等等,出了任何问题,我们首先想到的便是分析日志,查找问题原因.自 CentOS 7 开始,我们的 CentOS 便开始使用 rsyslog ...

  9. syslog协议及rsyslog服务全解析

    背景:需求来自于一个客户想将服务器的日志转发到自己的日志服务器上,所以希望我们能提供这个转发的功能,同时还要满足syslog协议. 一.什么是syslog协议 1.介绍(略) 2.syslog标准协议 ...

  10. rsyslog配置解析

    本地Rsyslog版本: 8.25.0-1.el6.x86_64 配置 基本语法 Rsyslog 现在支持三种配置语法格式: sysklogd legacy rsyslog RainerScript ...

随机推荐

  1. Java Number类

    一般地,当需要使用数字的时候,我们通常使用内置数据类型,如:byte.int.long.double等. 例如: int i = 5000; float gpa = 13.65; byte mask ...

  2. IDEA添加非空Getter方法模板

    #if($field.modifierStatic) static ## #end $field.type ## #set($name = $StringUtil.capitalizeWithJava ...

  3. Fragment管理工具类

    Fragment相关→FragmentUtils.java→Demo addFragment : 新增fragment removeFragment : 移除fragment replaceFragm ...

  4. SharePoint 2013 页面中window/document.onload/ready 事件不能触发的解决方案

    问题1:在SharePoint 2013页面中使用Javascript 事件window/document.onload/ready时,你会发现处理onload/ready事件的代码根本不能执行. 问 ...

  5. C#文件操作工具类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  6. 使用T4模板调用Sqlserver链接生成自己的模板

    <#@ template debug="false" hostspecific="false" language="C#" #> ...

  7. Golang 在 Mac、Linux、Windows 交叉编译

    https://blog.csdn.net/panshiqu/article/details/53788067

  8. maven的多环境配置

    <profiles> <profile> <id>dev</id> <activation> <activeByDefault> ...

  9. WinForm中实现HotKey

    最近在写一个游戏辅助工具,来点Win变成的总结 主要用了RegisterHotKey:UnregisterHotKey:两个winAPI 以下代码来自stackoverflow新增了一个HotKeyM ...

  10. switch和continue的关系

    突然想到 我们用 switch都是用 break return等关键字来配合,有没有一种情况下是用continue呢?而且如果真的出现了continue,结果是什么样的呢?