Loading your file into log reader. In the menu, click on File -> Open (or use Ctrl+O), and select the file – the main window will show all log events as a function of time.
You can open the text view window by pressing Ctrl+L.
Log patterns detection with a Log analyzer. A log pattern specifies how to extract values from the log events.
Patterns can be created automatically in the text view window: right-click on the selected string in the bottom window and select the destination. Alternatively, you can create your own pattern from scratch: press Ctrl+R (or select Windows -> Patterns), and press New to create a pattern.
Let’s take an example of pattern. The sample log line below is generated during Garbage Collection in the Java Vitrual Machine:
961.910: [GC [PSYoungGen: 135997K->36578K(174784K)] 409364K->334099K(961216K), 0.1033272 secs]
In order to extract the volume of residual memory which is printed after the second arrow sign (->), we can create a Value pattern *->*-># as shown below
If we need to extract the last value in the log line (which GC time), the pattern could look like
In a search pattern, the * character is a placeholder for any number of any characters of a log event. The # character shows the place where a numeric value is expected.
Once corresponding pattern is created and selected, press Reload button, open Statistics window (press Ctrl+A or use menu Windows -> Statistics), and select the Values tab:
If you don’t see the grid lines, and you want them, right click the image and check Grid Y option.
Working With Log Patterns (Advanced)
Log Viewer uses special expressions (similar to regular expressions, used e.g. in Linux grep command) to find log events for analysis. You can use either independent events that match Value pattern OR pairs of events using Start and Stop patterns.
All patterns are configured in the Patterns window (press Ctrl+R to open or hide it).
A group of three patterns which has a title and might also comprise Ignore string builds a Pattern Set. The list of configured Sets is shown on the left hand side of the window:
A Pattern Set does not necessarily contain all three (Start, Stop and Value) patterns. It may only contain either one Value pattern, or Start-Stop pair. But there has to be at least one pattern in a Set.
The following characters have special meaning in Patterns, as described below.
? Matches any single character
* Matches any sequence of characters
# Matches an integer or floating point numeric value which is extracted for analysis. Floating point values are only used in Value patterns
< Denotes the beginning of Options subpattern
> Denotes the end of Options subpattern
, Used as a separator within Options subpattern and remains a literal comma character elsewhere
All other characters (including whitespaces) are treated as literals.
*th=# matches the following line
HTTP Protocol=http Content Length=23415
as * matches the string up to th= which is literally specified in the pattern, and the value 23415 is extracted for analysis.
Start and Stop patterns
correspondingly match the lines
Java Thread with id=347 allocated
Java Thread with id=347 released
Time elapsed between these two log lines can be used for analysis.
Log Pattern Analysis Functionality In Log Viewer
There are two basic types of analysis: either for independent events that match Value pattern OR for pairs of events using uses Start and Stop patterns.
Independent Events Analysis
Start-Stop Events Analysis
Also check out these 5 Things to Consider when selecting the Log Viewer most suitable for your task.