• 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
    
  • 相关阅读:
    JavaEE基础(01):Servlet实现方式,生命周期执行过程
    Spring 框架基础(06):Mvc架构模式简介,执行流程详解
    Spring 框架基础(05):事务管理机制,和实现方式
    多线程搜索与排序
    mybatis的Mapper代理原理
    spring的RestTemplate使用指南
    探索CAS无锁技术
    两年Java的面试经验
    HashMap多线程并发的问题
    解析Mybaits的insert方法返回数字-2147482646的原因
  • 原文地址:https://www.cnblogs.com/diaolanshan/p/9270646.html
Copyright © 2020-2023  润新知