Watch/read a growing log file

后端 未结 7 1100
春和景丽
春和景丽 2020-12-08 00:54

I have a log file that is constantly growing. How can I watch and parse it via a Ruby script?

The script will parse each new line as it is written to the file and ou

7条回答
  •  北海茫月
    2020-12-08 01:55

    Poor man's approach for quick stuff:

    1. a Ruby script that does

      ARGF.each do |line|
        ...
      
    2. Running screen with:

      tail -f file | ruby script 
      

提交回复
热议问题