shiji
V2EX  ›  问与答

如何把每条新出现的 log 当作参数输入给程序处理

  •  
  •   shiji · Mar 4, 2016 · 1511 views
    This topic created in 3758 days ago, the information mentioned may be changed or developed.
    Linux 系统里面的 log 都是直接往文本里面写的。

    我需要的是,希望能实时的把新出现的每行作为一个参数输入到我的某个脚本里进行实时分析。

    问问看看大家有没有什么方法
    3 replies    2016-03-04 14:12:28 +08:00
    ETiV
        1
    ETiV  
       Mar 4, 2016 via iPhone
    tailf path/to/your/log | your_program
    iamleung
        2
    iamleung  
       Mar 4, 2016
    ./your_program | xargs tailf -n 1 path/to/your/log
    publicAdmin
        3
    publicAdmin  
       Mar 4, 2016
    阿么,你为何不换个角度让你的脚本实时的去读日志文件。。看新追加的信息,
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2701 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 14:23 · PVG 22:23 · LAX 07:23 · JFK 10:23
    ♥ Do have faith in what you're doing.