Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
tsuibin
V2EX  ›  Linux

linux dhcp 日志记录的内容是否可以配置?

  •  
  •   tsuibin ·
    tsuibin · Mar 21, 2014 · 4203 views
    This topic created in 4444 days ago, the information mentioned may be changed or developed.
    现在有一台DHCP服务器,使用rsyslog记录日志

    配置为:
    /etc/rsyslog.d$ cat 30-dhcpd.conf
    local7.* -/var/log/dhcpd.log

    记录内容为:
    ar 18 07:58:44 00-0e-0c-ab-6c-90 dhcpd: DHCPDISCOVER from 0c:30:21:f1:37:5c via eth2
    Mar 18 07:58:45 00-0e-0c-ab-6c-90 dhcpd: DHCPOFFER on 192.168.0.85 to 0c:30:21:f1:37:5c (iPhone) via eth2
    Mar 18 07:58:46 00-0e-0c-ab-6c-90 dhcpd: Can't create new lease file: Permission denied
    Mar 18 07:58:46 00-0e-0c-ab-6c-90 dhcpd: DHCPREQUEST for 192.168.0.85 (192.168.0.1) from 0c:30:21:f1:37:5c (iPhone) via eth2
    Mar 18 07:58:46 00-0e-0c-ab-6c-90 dhcpd: DHCPACK on 192.168.0.85 to 0c:30:21:f1:37:5c (iPhone) via eth2
    Mar 18 08:35:23 00-0e-0c-ab-6c-90 dhcpd: DHCPDISCOVER from 48:28:2f:a6:86:37 via eth2
    Mar 18 08:35:24 00-0e-0c-ab-6c-90 dhcpd: DHCPOFFER on 192.168.0.61 to 48:28:2f:a6:86:37 (android_f4d80b78fa14bc2d) via eth2
    Mar 18 08:35:25 00-0e-0c-ab-6c-90 dhcpd: DHCPREQUEST for 192.168.0.61 (192.168.0.1) from 48:28:2f:a6:86:37 (android_f4d80b78fa14bc2d) via eth2
    Mar 18 08:35:25 00-0e-0c-ab-6c-90 dhcpd: DHCPACK on 192.168.0.61 to 48:28:2f:a6:86:37 (android_f4d80b78fa14bc2d) via eth2
    Mar 18 08:40:21 00-0e-0c-ab-6c-90 dhcpd: DHCPREQUEST for 192.168.0.61 from 48:28:2f:a6:86:37 (android_f4d80b78fa14bc2d) via eth2



    现在有没有办法通过配置,只记录DHCPACK的条目?
    还是没有办法配置,只能后期处理?
    1 replies    1970-01-01 08:00:00 +08:00
    tsuibin
        1
    tsuibin  
    OP
       Mar 21, 2014
    要是不能配置 就只能从源码下手了

    dhcp-4.2.6/omapip/errwarn.c

    128 /* Log a note... */
    129
    130 int log_info (const char *fmt, ...)
    131 {
    132 va_list list;
    133
    134 do_percentm (fbuf, fmt);
    135
    136 /* %Audit% This is log output. %2004.06.17,Safe%
    137 * If we truncate we hope the user can get a hint from the log.
    138 */
    139 va_start (list, fmt);
    140 vsnprintf (mbuf, sizeof mbuf, fbuf, list);
    141 va_end (list);
    142
    143 #ifndef DEBUG
    144 syslog (log_priority | LOG_INFO, "%s", mbuf);
    145 #endif
    146
    147 if (log_perror) {
    148 IGNORE_RET (write (STDERR_FILENO, mbuf, strlen (mbuf)));
    149 IGNORE_RET (write (STDERR_FILENO, "\n", 1));
    150 }
    151
    152 return 0;
    153 }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2938 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:03 · PVG 23:03 · LAX 08:03 · JFK 11:03
    ♥ Do have faith in what you're doing.