timecat - 強大的日志搜索輔助工具

jopen 10年前發布 | 6K 次閱讀 timecat

timecat

強大的日志搜索輔助工具 - A powerful tool for search in log files.
環境要求/requirements:Python2.x

安裝 - Installation

兩種方式 - There are two ways to get timecat.

  1. pip install timecat
  2. 或下載timecat文件后放在你的默認程序執行路徑下 - Or directly download the timecat file, then add it to your default execution PATH </p>

    使用 - Usage

    1. timecat -d '2016-01-02' -s '20:13:14' -e '20:14:13' LOGFILE1.log LOGFILE2.log ...
    2. timecat -s '2016-01-02 20:13:14' -e '2016-01-02 20:14:13' LOGFILE1.log LOGFILE2.log ...
    3. For more: timecat -h
    4. </ol>

      簡介 - Description

      中文簡介

      假如給你一個日志文件A.log,它的大小達到了28G

      日志的起始時間為Jan 1 20:13:14,日志的結束時間為Dec 31 20:14:13

      現在要求你從中找出4月3號早上10點9分08秒到4月4好早上6點5分04秒的所有日志并輸出

      你會怎么做?用awk?用grep?還是用sed?

      使用了timecat,你可以這樣做:

      timecat -s 'Apr  3 10:09:08' -e 'Apr  4 06:05:04' A.log > timecat.out

      這樣,timecat.out保存的就是你想要的數據,定位速度之快超乎你想象。
      如果你在生產環境中需要搜索海量的日志,這個工具一定是你的得力助手。

      English Description

      Imagine that given a log file A.log with its size reaches to 28G

      The log starts from Jan 1 20:13:14, ends with Dec 31 20:14:13

      Now you are required to output all the lines between April 3rd 10:09:08 and April 4th 06:05:04

      What will you do? Use awk? Use grep? Or sed?

      With timecat, you can do it this way:

      timecat -s 'Apr  3 10:09:08' -e 'Apr  4 06:05:04' A.log > timecat.out

      After this, timecat.out stores what you want, at an amazing searching speed.
      When you have to search huge amounts of log files in production environment, this helps alot, saving huge amounts of disk I/Os, more importantly, time.



      項目地址: https://github.com/fanfank/timecat

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!