Part of administering web servers is looking through log files for clues whenever you come across issues with your web server or web applications. The logs most often will tell you exactly what went wrong. However, log files can be separated into multiple files and compressed to save space.
To search for a particular text through multiple files easily, use the following command:
find . -name "*.gz" | xargs -n 1 grep -H "[text to search]"
Or if the log files are compressed with gzip, use the following command:
find . -name "*.gz" | xargs -n 1 zgrep -H "[text to search]"
Add new comment