timecat - 強大的日志搜索輔助工具
timecat
強大的日志搜索輔助工具 - A powerful tool for search in log files.
環境要求/requirements:Python2.x
安裝 - Installation
兩種方式 - There are two ways to get timecat.
pip install timecat或下載
timecat文件后放在你的默認程序執行路徑下 - Or directly download thetimecatfile, then add it to your default execution PATH </p>使用 - Usage
timecat -d '2016-01-02' -s '20:13:14' -e '20:14:13' LOGFILE1.log LOGFILE2.log ...
timecat -s '2016-01-02 20:13:14' -e '2016-01-02 20:14:13' LOGFILE1.log LOGFILE2.log ...
- For more:
timecat -h
</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.logwith its size reaches to 28G
The log starts fromJan 1 20:13:14, ends withDec 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?
Withtimecat, 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.outstores 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.