I need to come up with a more elegant solution than my current.
Goal is to find all logs which have a repeated pattern and list the pattern and how many times it is repeated in a log. Problem is in order to use regex I need to know the pattern format and I do not. Is there any workaround around this?
Currently I use TB to count all errors, then copy part of error into that TB to count how many times this specific one occurs. I keep track manually of all these and then use -v to see how many are left. Great to have TB and speed up the process but I am wondering if this may be achievable in a better way.
Downloading the log files is not an option, so I depend on bash.
Using grep, I am looking for " E" followed by something indicating a pattern. This pattern can occur in several places. When looking manually I would search for anything between 1 and 4 words, very rarely more, and count occurrence to establish what is the most common error in the log or logs. I have to read the logs and identify the pattern manually. The using grep -v i remove all the atrings I have already searched for to see how many matching are still left, and repeat.
In the end I have a list of all occurrences with how many times they occur in a specific log file. Would be fabulous to have all this automated!
NB
"E" is usually preceded by a space, after the ":" the first few words are important. How do I compare one unknown pattern to the rest of the log in order to determine how many times it occurs?
Example 1
E IzatSvc_PassiveLocListener: E/Exiting with error virtual void izat_manager::IzatPassiveLocationListener
In above example all words are useful
Example 2
E/Cobra.HttpBuilder( 2404): java.net.ConnectException: Failed to connect
In above example error code is useful to check for this specific one, but then I would search omitting the numerals and everything following them it to see if there are other similar error codes.
Example 3
E ExoPlayerImplInternal: Playback error
Example 4
E Cobra.HttpBuilder: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)