这是一个创建于 3925 天前的主题,其中的信息可能已经有所发展或是发生改变。
现在有一台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 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
tsuibin 2014-03-21 16:44:27 +08:00
要是不能配置 就只能从源码下手了
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 }
|