1

I want to parse in OstrosLogViewer a karaf log file that looks like:

15:01:56,405 | INFO  | Framework stop   | .osgi.CXFExtensionBundleListener  112 | 101 - org.apache.cxf.cxf-core - 3.1.5 | Removing the extensions for bundle 174
15:01:56,405 | INFO  | Framework stop   | .osgi.CXFExtensionBundleListener  112 | 101 - org.apache.cxf.cxf-core - 3.1.5 | Removing the extensions for bundle 111
15:01:56,405 | INFO  | Framework stop   | .osgi.CXFExtensionBundleListener  112 | 101 - org.apache.cxf.cxf-core - 3.1.5 | Removing the extensions for bundle 175

Log pattern is:

%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n

I created a pattern. But parsing fails.

type=log4j-native
conversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
name="Test"
charset=UTF-8

I also tried with below. But it doesn't parse either.

type=log4j
pattern=TIMESTAMP|LEVEL|THREAD|CLASS|BUNDLEMESSAGE
dateFormat=HH:mm:ss,SSS
name="TEST2"
charset=UTF-8
eric44
  • 11
  • 2

1 Answers1

0

I was able to parse with following parser:

type=log4j
pattern=TIMESTAMP | LEVEL | THREAD | .CLASS MESSAGE
dateFormat=HH:mm:ss,SSS
name=Stackoverflow
charset=UTF-8

You have to use MESSAGE instaed of BUNDLEMESSAGE. There are also spaces before and after |.

KrzyH
  • 4,256
  • 1
  • 31
  • 43