Python has a plugin that allows us to implement features similar to Linux under Tailf, grep, and awk on a Web page. The name of this plugin is Tailon.
Install plug-ins,
Pip Install Tailon
Start the service:
Tailon-f/var/log/nginx/*/var/log/apache/{access,error}.log
The service can be used in the browser if it starts normally: http://localhost:8080 access.
More commands:
Usage:tailon [-C Path] [-F path [path ...]] [-h] [-d] [-V] [--output-encoding Enc] [--input-encoding Enc] [-B Addr:port] [-R Path] [-P type] [-U User:pass] [-A] [-F] [-T Num] [-M [cmd [cmd ...]] [--no-wrap-lines] Tailon is a web app. looking at and searching through log files. Required options:-C,--config Path Yaml config file-f,--files path [path ...] List of files or file wildcards to Exposegeneral options:-H,--help show this help message and exit -D,--debug show Debug Messages-v,--version Show program ' s version number and E XIT--output-encoding ENC encoding for output--input-encoding ENC encoding for input and output (d Efault UTF8) Server options:-B,--bind Addr:port listen on the specified address and port-r,--relative-root Path Web App root path-p,--http-auth type enable HTTP authentication(Digest or Basic)-u,--user user:pass HTTP authentication username and password-a,--allow-transfers Allow log file downloads-f,--follow-names allow tailing of not-yet-existent files-t,--tail-lines nu M number of lines to tail initially-m,--commands [cmd [cmd ...] Allowed commands (default:tail grep awk) user-interface options:--no-wrap-lines initial line-wrapping St Ate (default:true) Example config file:bind:0.0.0.0:8080 # address and port to bind on Allow-transfers:true # Allow log file downloads Follow-names:false # Allow tailing of not-yet-existent files Relative-root:/tailon # web App Root path (default: ') commands: [Tail, grep] # allowed Commands tail-lines:10 # Number of lines to Tai L initially wrap-lines:true # initial line-wrapping State files:-'/var/log/messages '-'/var/log/nginx/* . Log '-'/var/log/xorg. [0-10].log '-'/var/log/nginx/' # All files in this directory-' cron ': # It's possible to add sub-sections-'/var/log/cron* ' Http-au Th:basic # Enable authentication (optional) Users: # password access (optional) user1:pass1e Xample command-line:tailon-f/var/log/messages/var/log/debug-m tail tailon-f '/var/log/cron* '-a-b localhost:8080 Tailon-f/var/log/-P basic-u user1:pass1-u user2:pass2 tailon-c config.yaml-d
Python Web version Tailf, grep