In this post I will be showing you how to check your log files for errors. Your log files should be located in the /var/log/ directory. We will be using vague search terms such as error and fail so keep in mind that just because you get a result doesn’t mean you actually have a problem, there will almost always be some noise in the results.
If you want to check all your logs for certain search strings you can do so by running the following either directly in your terminal or by saving it as a script and running it, don’t forget to modify the grep piece of the loop to what you are searching for.
for a in /var/log/*; do
grep -iE "error|fail" $a 2>/dev/null;
echo ' ';
Checking Single Logs
In this example we will take a look at the DMESG log. You have 2 options for checking DMESG, you can run the dmesg command or you can look in /var/log/dmesg. In the example below I will run the dmesg command and pipe the output into grep for 2 different search terms.
dmesg | grep -iE "error|fail"
grep -iE "error|fail" /var/log/dmesg # You can substitute the search terms and the log file
I hope you enjoyed this quick and to the point post, please don’t forget to like/comment/share! =)