Multi-Patterns

It is very common to have one logging format per log file. However, this is not a hard requirement and it is possible to have multiple logging formats in a single log file.

The Pattern Parser and Regex Parser allow the possibility of multiple conversion patterns, one per line, as can be seen in the screenshot below:

Multi-patterns cannot be configured using the Parser Wizard.  You must use manual parser configuration instead.

When using multiple conversion patterns, it's important to keep a few things in mind. First, using multiple patterns will always be slower than using a single pattern. This is because the parser will expect a degree of error when parsing the log file and a single log line will often be parsed multiple times.

When using multi-patterns the first pattern which successfully parses the log line will be used.  Therefore, it is best to put more generic patterns which match log fields more broadly at the bottom of the pattern list.  For example, '%d %m%n' would match most log entries and therefore should be placed near the bottom.

If your patterns differ only in the date format used consider using the date specifier without any arguments.  In this configuration, LogViewPlus will attempt figure out the timestamp format dynamically.  Alternatively, if the date formats differ only in the number of milliseconds used to represent the timestamp, consider using f*.

Patterns which span multiple lines, such as those which declare '\n' as part of the static text, are not supported in multi-patterns.

Finally, when using multi-patterns, it is important that the individual patterns are distinct.  For example, if you were using two patterns and every log entry could be parsed by either pattern successfully then LogViewPlus will not know which pattern to use.  'Successful' in this case means that the log entry is parsed without error and does not necessarily mean that data is placed in the correct column.

< >