Reputation: 10721
I have a log file and want to create a webpage (possibly Python but not strictly) that will work much like unix "tail -f filename" command works (show new log lines when they are written to file).
So that user will continuously see log right in browser.
How would you implement this?
Upvotes: 11
Views: 13986
Reputation: 572
Disclaimer : I wrote this https://www.npmjs.com/package/tail-fweb
You can browse code on npm. This can be installed as a command
install -g tail-fweb
And used like tail -f
tail-fweb -port 3000 -f file.log
Upvotes: 0
Reputation: 748
Scullog, having capability of sharing the local drive to the browser. Stream the log file via Socket.IO over browser. It run on any platform such as windows/linux/mac. It run as service or standalone mode.
Upvotes: 1
Reputation: 4107
Tailon is a python webapp that, among other things, provides tail -f
like functionality. In addition, wtee (a sister project of tailon) can make all its stdin viewable in the browser - its use is identical to the unix tee
command: tail -f filename | wtee
Upvotes: 9
Reputation: 181
I implemented this using jquery (.ajax) and php (json).
The flow is essentially as follows:
In my specific implementation, i did the following:
See my longpolling/realtime tail implementation using jquery and php here: https://github.com/richardvk/web_file_tail
Upvotes: 2
Reputation: 5884
You read the file and print the last lines to the page. You might also use a GET-variable to you define number of rows to output using ?n=x where x is the number of lines.
Upvotes: 0