Helpful commands for analyzing log files
There’s lots of ways to go through log files and dig out what you need. Some or more complex then others and some will get you what you’re looking for faster, better or easier. But I’ve found there are some basic commands that will get you rolling quickly.
Basic commands
This ones kind of obvious but sometimes it’s easiest to just open the file with an editor and search for what you’re looking for.
Sometimes you don’t want to filter through the whole file but still want something basic and easy to use.
These came in handy after a script I wrote to port data from a CSV to a new system dumped all errors into a log file.
To get the number of lines with the error. I use this to see how big of a problem I have.
grep -A 1 '"maintainer_email": ' log_file.log | wc -l