On 1/20/26 1:35 PM, Tom Smyth wrote:
Folks,

do any of you do the equivalent of tail -f  /var/log/syslog and
somehow pipe it to  a web application that would display that
content  on a webpage...

Im trying to stream logs for a tool to  then filter and display for
my helpdesk / NOC team...

any suggestions welcome

Thanks

Tom Smyth



I suspect this is a really bad idea poorly implemented, but it
seems to "Work For Me" (and we know how dangerous that logic is!)
and I'm not sure why it's a bad idea, so I'm presenting it with
the goal of being shot down.

Put this in /var/www/cgi-bin, and put the sh, tail, and the required
libraries into the chroot.

===============================
#!/bin/sh

echo Content-type: text/HTML
echo

echo "<h1>log follower:</h1>"


echo '<pre>'

tail -f /logs/website.access
echo "
</pre>
<p>"
==============================
(yeah, and all the stuff after the "tail -f" is never going to
execute).

You should run it through a sanitizing filter that only passes
what you desire to come through, so someone doesn't stuff your
log with malicious HTML.  Maybe that can even make it look
pretty or more readable.

Not HTML5, not valid HTML by any standard, but it renders.  You
probably need to crank up the timeout on slowcgi, otherwise it
will disconnect after a couple minutes (I did not do this...maybe
there's some other timeout that's going to kill it later)

Of course, the desired logs have to be within the chroot of the
webserver.  And I'd give people a chance to say what a STUPID
idea this is before implementing it. :)

Nick.
(sometimes, my role is to be a bad example)

Reply via email to