What pattern should I use to retrieve correctly multi-lines logs ?
Normally I use :
file {
path => "/var/log/appslogs/**/*.log"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => multiline {
pattern => "^\s"
what => "previous"
}
type => "app"
}
Here is an exemple of logs (with and without error) :
2023-02-09 00:00:03 [DEBUG] org.apache.activemq.util.ThreadPoolUtils:54 -> Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@646bc5f[Running, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 1] 2
2023-02-09 00:00:03 [ERROR] org.apache.camel.component.jms.DefaultJmsMessageListenerContainer:934 -> Could not refresh JMS Connection for destination 'EVENT-BUS-GET-ECHO-V1-eures-jv-batch-01' - retrying using FixedBackOff{interval=5000, currentAttempts=9124, maxAttempts=unlimited}. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://eures-jms:31314. Reason: java.net.UnknownHostException: eures-jms
javax.jms.JMSException: Error while attempting to add new Connection to the pool
at org.apache.activemq.jms.pool.PooledConnectionFactory.createJmsException(PooledConnectionFactory.java:279)
at org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:230)
at org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:209)
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:413)
at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:398)
at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:915)
at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:890)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1061)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750) 3
But it's not working for this type of error.
Here is my grok pattern if you need it :
%{TIMESTAMP_ISO8601:time} \[%{LOGLEVEL:log_level}\] %{GREEDYDATA:message_of_log}