How to fast check some archived log file

Post Reply
User avatar
isscbta
Posts: 39
Joined: Mon Jul 19, 2021 1:41 am

Logrotated log files are usually gzip-ed.
Fast way to 'cat' them is:

Code: Select all

zcat /var/log/somelog.2.gz
Fast way to 'grep' them:

Code: Select all

zgrep 'lookingfor' /var/log/somelog.2.gz
If you need another processing command, for example 'exigrep', you can process .gz file through the 'zcat' pipe output:

Code: Select all

zcat /var/log/exim4/mainlog.2.gz | exigrep 'somedomain.com'
To zgrep all *.gz log files:

Code: Select all

zcat /var/log/exim4/mainlog.*.gz | exigrep 'somedomain.com'
Post Reply