Django view linux real-time log

I. Overview

There is a bastion machine that can connect to several servers on the back end. Developers need to log in to the back-end server and use tail -f to view real-time logs.

However, typing commands is cumbersome and requires a management platform to download logs and view real-time logs.

 

2. Project Demo

The complete github code is as follows:

https://github.com/py3study/real_time_log

 

principle

This program runs on the server of the springboard. It can log in to all back-end hosts without secret. Use ls -l / var / log to view the back-end directory list.
Use Python to call system commands, and display the results in HTML.
When downloading, first scp the backend server log to the / tmp / log_download directory of the springboard , and then use django to download the log.
View real-time logs, use websocket, back-end call tail -f command

 

effect

Home

Directory browsing

 

 

Real time log

 

Guess you like

Origin www.cnblogs.com/xiao987334176/p/12714503.html