<div dir="ltr">Give this a shot, see if it gets close to kinda what you're wanting:<div><br></div><div><a href="http://pastebin.com/mi168bYi">http://pastebin.com/mi168bYi</a><br></div><div><br></div><div>Just feed it the full pathname of the dhcpd.leases file and it'll watch the file and print out anything that's appended to it. Change line 22 to do whatever it is you need with the output instead of printing it to a file.</div><div><br></div><div>(code copied from <a href="http://code.activestate.com/recipes/157035-tail-f-in-python/">http://code.activestate.com/recipes/157035-tail-f-in-python/</a> )</div><div><br></div><div>--chip</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 5, 2015 at 5:24 PM, Scott Bragg <span dir="ltr"><<a href="mailto:walkingbear@gmail.com" target="_blank">walkingbear@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I'd approach it by experimenting with inotifywait and piping the diff of the pre-change with post-change file. I'm not at a system that I can experiment with, but that's my first blush idea of which direction to go. <br><br></div>OSSEC uses inotify, epoll and such for it's realtime monitoring and reactive monitoring. You could easily set up a trigger in OSSEC to do what you want, but that'd be *extreme* overkill. <br><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Scott Bragg<br><br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 5, 2015 at 5:10 PM, Alex Carver <span dir="ltr"><<a href="mailto:agcarver+ale@acarver.net" target="_blank">agcarver+ale@acarver.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Could you set up a cron job every minute that MD/SHA hashes the file,<br>
compares with the hash from a previous iteration, and if the hashes<br>
don't match, diff the new with the old and process the diff result?<br>
(Obviously if a difference in the hashes is found you save state to use<br>
for the next round of comparisons.)<br>
<span><br>
On 2015-01-05 11:49, James Sumners wrote:<br>
> For those interested, parsing the data in realtime, at least with Node.js,<br>
> is not viable. So this question is irrelevant.<br>
><br>
> On Thu, Dec 18, 2014 at 12:59 PM, James Sumners <<a href="mailto:james.sumners@gmail.com" target="_blank">james.sumners@gmail.com</a>><br>
> wrote:<br>
><br>
>> I need to monitor ISC's dhcpd.leases file so that I can feed new leases<br>
>> into a processor (which will log them to a database). My processor listens<br>
>> for data on a Unix socket . So I'll want to feed the data being appended to<br>
>> dhcpd.leases into that socket. But I also need it to still write to the<br>
>> leases file.<br>
>><br>
>> Does anyone have any suggestions on how I might go about doing this? It's<br>
>> going to need to run non-stop.<br>
>><br>
>> --<br>
>> James Sumners<br>
>> <a href="http://james.roomfullofmirrors.com/" target="_blank">http://james.roomfullofmirrors.com/</a><br>
>><br>
>> "All governments suffer a recurring problem: Power attracts pathological<br>
>> personalities. It is not that power corrupts but that it is magnetic to the<br>
>> corruptible. Such people have a tendency to become drunk on violence, a<br>
>> condition to which they are quickly addicted."<br>
>><br>
>> Missionaria Protectiva, Text QIV (decto)<br>
>> CH:D 59<br>
>><br>
><br>
><br>
><br>
><br>
><br>
</span>> _______________________________________________<br>
<span>> Ale mailing list<br>
> <a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
<br>
</span>_______________________________________________<br>
<div><div>Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Just my $.02, your mileage may vary, batteries not included, etc....</div>
</div>