Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tail a text file on a web server via HTTP

Looking for input on how to solve the following problem. My ColdFusion 9 app has a simple logger that writes text to a file. On my dev machine, the file is local so I can use either 'tail -f' or CFB's TailView to watch it. I'd like a tool to watch it when it's deployed on the production server. The catch: production is at a shared CF hosting provider which doesn't allow RDS file access or a directory-watcher gateway. I'm wondering about a page with a meta refresh tag or if I want to get more fancy, something AJAXy to the same effect. Thoughts? Any tools that already exist for this?

I may experiment with this but am hoping there is something out there "more complete" : following a log file over http

like image 915
DaveBurns Avatar asked May 31 '11 14:05

DaveBurns


1 Answers

You can you the following PHP script:

<?php
header("Content-Type: text/plain");
set_time_limit(0);
passthru("tail -F -n +0 log.txt");
?>
like image 166
Owen Avatar answered Oct 14 '22 04:10

Owen