• 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
    
  • 相关阅读:
    昆石VOS3000_2.1.4.0完整安装包及安装脚本
    KVPhone,VOS官方的SIP软电话电脑客户端
    昆石VOS2009 VOS3000无漏洞去后门电脑管理客户端大全
    2017年最新(4月20日)手机号码归属地数据库分享
    2017年最新VOS2009/VOS3000最新手机号段导入文件(手机归属地数据)
    Android:onNewIntent()
    三星S4使用体验(Markdown版)
    apple公司的潮起潮落——浪潮之巅
    microsoft的罗马帝国——浪潮之巅
    我的iOS开发之路
  • 原文地址:https://www.cnblogs.com/diaolanshan/p/9270646.html
Copyright © 2020-2023  润新知