Probably, everyone who ever had to watch at the same time for a large number of windows with logs, was thinking about transferring some of them to the screen of a tablet or phone.
And, being far from the computer, monitor the exhaust of the recently launched a large and terrible service?
Of course, you can put the ssh client on the phone, but this is not very convenient.
Therefore, I decided to make a mini-service that simplifies the “remote” viewing of logs.

Brief summary
The open source service
cantail.me , laid out on
github .
Free console client (
github ). To simply send data is enough:
long-runnig-app | tailme
And copy the link from the opened browser window. Or you can add the
-s parameter and just copy it from the terminal.
')
For example, the
nginx command
log is now running:
tail -f /var/log/nginx/cantailme.access.log | tailme -s
Client installation
In ubuntu 11.10+, the application can be installed from
ppa :
add-apt-repository ppa:nvbn-rm/ppa apt-get update apt-get install tailme
In other distributions you can install via pip:
pip install -e git+https://github.com/nvbn/cantailme-client.git
Or through the installation script:
git clone https://github.com/nvbn/cantailme-client.git cd cantailme-client python setup.py install
Under the hood

Client implementation is very simple - a loop that reads stdin and sends new lines to the server.
To prevent data substitution, the server during session initialization gives the hash-identifier and “secret”, which are later used to send “strings”.
The server part is a bit more complicated, it can be divided into 3 conditional entities:
- http "server" engaged in rendering 2 views;
- jsonrpc api , with which the console client initializes the session and sends data to the server;
- push server for sending real-time clients received via api.
The interaction between parts of the system takes place with the help of RabbitMQ.
Push works through
tornado-sockjs .
To save resources, logs are loaded directly into the file and are sent via nginx, bypassing django.
For those who want to fill in
/ dev / urandom or large logs, a
“harsh” script runs every 5 minutes.
Depla

In this case, it is not trivial, but I have already encountered a
similar situation . The main reasons for choosing such a scheme:
- it is not uncommon for non-standard ports to be cut, so tornado and django should hang on the same standard port;
- getting nginx to work fine with websockets is problematic;
- HAProxy does not distribute static;
- I managed to drive this scheme in production on non-experimental projects =)
In case of errors, write bug reports in the tracker for the
server and the
client . Or in the comments to this post =)
PS with habrastorage there was a cant, perezalil pictures to yourself.