zoukankan      html  css  js  c++  java
  • Python Web 版本tailf, grep

    Python有一个插件,可以让我们在网页上实现类似于Linux 下tailf, grep和awk的功能。这个插件的名字是tailon。

    安装插件,

    pip install tailon
    

     启动服务:

    tailon -f /var/log/nginx/* /var/log/apache/{access,error}.log
    

     服务如果正常启动就可以在浏览器里使用:http://localhost:8080 访问。

     更多命令:

    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 for 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 expose
    
    General options:
      -h, --help                      show this help message and exit
      -d, --debug                     show debug messages
      -v, --version                   show program's version number and exit
      --output-encoding enc           encoding for output
      --input-encoding enc            encoding for input and output (default 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 num            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 state (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 tail 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-auth: basic        # enable authentication (optional)
      users:                  # password access (optional)
        user1: pass1
    
    Example 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
    
  • 相关阅读:
    Springboot 2响应式编程 WebFlux 初体验
    MyBatis集成到Spring
    Java 常用的转换、排序
    Springboot 2使用外部Tomcat源码分析
    Springboot 2启动内置Tomcat源码分析
    Springboot 2启动源码流程
    Springboot 2使用SpringApplication
    IDEA效率插件JRebel的使用
    Spring 源码总结
    Spring事件监听器源码
  • 原文地址:https://www.cnblogs.com/diaolanshan/p/9270646.html
Copyright © 2011-2022 走看看