How can I "tail -f" into a constantly updating web page?
March 25, 2008 6:34 AM   Subscribe

How can I effectively "tail -f" into a constantly updating web page?

I've got a log file that I need to have visible in a web page, constantly updating, kind of like doing 'tail -f logfile' in a console. I've seen this done before (e.g. the Shoutcast server has a built-in cgi routine that will constantly update the page with the contents of the sc_serv.log file) without having to manually refresh the page. A meta-refresh won't work because you'll lose your place in the log (the page may rescroll to the top).

The caveat is that I'm using IIS5 on Win2k. I can't install PHP or Perl (policy), otherwise this might be a walk in the park.

Any ideas? Got two seconds to give me some awesome code, or link me to something where this has been done before?
posted by kuperman to Computers & Internet (8 answers total)
Couldn't you just use a meta refresh to redirect to the page's URI with a named anchor?

<meta http-equiv="refresh" content="5;url=http://uri-of-page#end">
... log file content ...
<a name="end">The End.</a>

posted by enn at 6:54 AM on March 25, 2008

What about AJAX, so the page doesn't reload, but is dynamically changed? I'm not familiar enough with AJAX to write any code, but it should be one of the simpler AJAX projects. Just have it request a logfile URL periodically and update the page accordingly.

This might suit your needs? I swear I've seen a zillion things to do this, but now I can't find 'em.
posted by fogster at 7:12 AM on March 25, 2008 [1 favorite]

Response by poster: Well, I don't have AJAX on this server either, I'm just trying to see what I can do about using stock modules in IIS.
posted by kuperman at 10:36 AM on March 25, 2008

AJAX is not something you install on a server, at least not directly. It's an implementation technique. In this case, the solution fogster linked to uses PHP on the server, however.
posted by Asymptote at 10:53 AM on March 25, 2008

AJAX is a client-side Javascript method. Doesn't need anything on the server.
posted by matthewr at 11:40 AM on March 25, 2008

The script fogster links to looks like it will work. The only problem is the logtail.php that it uses, since you can't use PHP.

I know very little about IIS, but couldn't you hack up an ASP using VBScript that performs the same function as logtail.php? There are versions of 'tail' available for Win32, so all you'd have to do is redirect the output. This is assuming that security restrictions on the server allow you to execute arbitrary programs (maybe not).
posted by neckro23 at 12:09 PM on March 25, 2008

Response by poster: That'd probably be cool and all ... but I don't know the first thing about writing ASP, either. Not really a programmer.

(Man, I'm helpless.)
posted by kuperman at 12:17 PM on March 25, 2008

I think this might be what you're looking for. It's a real-time graphical representation of the results of 'tail'. It was on Slashdot a few months ago and it looks very cool. Watch the movie.
posted by Cobalt at 10:14 PM on March 26, 2008

« Older Career counseling for science types   |   A mp3 or an mp3? Newer »
This thread is closed to new comments.