Jason Pyeron
2011-Feb-02 23:45 UTC
[CentOS] [OT] Best way to get dhcpd messages piped to a web service.
Starting off, it is important not to loose any dhcp messages, especially during log rotation. My first thought on this would be to add a fifo to syslog.conf and slup from it, like: # perl -ne 'm/.../ && WWW::Curl ...' < /var/log/messages.fifo Does anyone see a more proper way? tail -F / -f could both miss messages during log rotation (please correct me if I am wrong) What are some of the problems that could be manifested in syslog if the fifo consumer stops consuming or has other issues? -Jason -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00.
Cameron Kerr
2011-Feb-03 04:01 UTC
[CentOS] [OT] Best way to get dhcpd messages piped to a web service.
On 03/02/11 12:45, Jason Pyeron wrote: [snip]> Does anyone see a more proper way?That depends. What are you really wanting to achieve? Might your problem be better solved by looking at the dhcp leases file instead, or are you really just interested in the logs? search.cpan.org reveals Net::ISC::DHCPd and Text::DHCPLeases as possible candidates for inclusion.> tail -F / -f could both miss messages during log rotation (please correct me if > I am wrong)You could also include something like 'tail --follow=name'. If you are worried about log rotation, it would probably be better to hook into logrotate's pre/postrotate mechanism.> What are some of the problems that could be manifested in syslog if the fifo > consumer stops consuming or has other issues?You would need to do something intelligent if syslogd were to restart (eg. because of an update). You would also need to make sure that your script started after syslogd.