Colorize tail output

后端 未结 6 556
慢半拍i
慢半拍i 2021-01-30 07:27

I\'ve been trying to make tail a little more readable for server startups. My current command filters out most of the INFO and DEBUG messages from the startup:

         


        
6条回答
  •  迷失自我
    2021-01-30 07:47

    I wrote TxtStyle, a small utility for colorising logs. You define regular expressions to highlight in ~/.txts.conf file:

    [Style="example"]
    !red: regex("error")
    green: regex("\d{4}-\d\d-\d\d")
    # ...
    

    And then apply the styles:

    txts -n example example.log
    

    or you can also pipe the output

    tail -f example.log | txts -n example
    

提交回复
热议问题