📜 ⬆️ ⬇️

Up-to-date Unix Way or pipe to browser

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#egg=tailme 

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:


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:


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.

Source: https://habr.com/ru/post/147525/


All Articles