- Clone this repo.
- Run
cd logstream
to switch to directory. - Build the docker image using
docker build -t logstream .
. - Run
bash deploy.sh
to run the container. - Visit
http://localhost:8888/tail?f=<the_filename>&l=<num_of_lines>
.
Before running the docker container, application settings can be changed by changing the environment variable value passed. Below are the details of these variables:
LOGDIR
: directory of logfileLOGBUFFER
: application will wait these many seconds let the new accumulate before sending it forwardPINGINTERVAL
: websocket ping interval in secondPINGTIMEOUT
: websocket timeout duration in secondPORT
: webserver port
- User agent(javascript enabled) sends HTTP GET request on
/tail
- User agent is served with a blank html along with a javascript code
- Javascript code running at client side sends websocket open request at
/ws
- Application opens a websocket
- Javascript code sends
start_sending
message - Application attaches a asynchronous file reading script, which uses event loop once after every buffer period(
LOGBUFFER
) releases the event loop while buffering - Ping-Pong healthcheck mechanism takes care of closing stale connections asynchronously