Created
July 26, 2012 13:59
-
-
Save smougenot/3182192 to your computer and use it in GitHub Desktop.
Logstash Multiline Filter for Java Stacktrace (tested on field)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stacktrace java as one message | |
multiline { | |
#type => "all" # no type means for all inputs | |
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)" | |
what => "previous" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juil. 25, 2012 10:49:46 AM hudson.triggers.SafeTimerTask run | |
Grave: Timer task com.base2services.jenkins.SqsQueueHandler@32eea79d failed | |
com.amazonaws.AmazonClientException: Unable to calculate a request signature: Unable to calculate a request signature: Empty key | |
at com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:71) | |
at com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:55) | |
at com.amazonaws.auth.QueryStringSigner.sign(QueryStringSigner.java:83) | |
at com.amazonaws.auth.QueryStringSigner.sign(QueryStringSigner.java:46) | |
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:238) | |
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:170) | |
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:776) | |
at com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:564) | |
at com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:732) | |
at com.base2services.jenkins.SqsProfile.createQueue(SqsProfile.java:72) | |
at com.base2services.jenkins.SqsProfile.getQueueUrl(SqsProfile.java:62) | |
at com.base2services.jenkins.SqsQueueHandler.doRun(SqsQueueHandler.java:37) | |
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) | |
at java.util.TimerThread.mainLoop(Timer.java:555) | |
at java.util.TimerThread.run(Timer.java:505) | |
Caused by: com.amazonaws.AmazonClientException: Unable to calculate a request signature: Empty key | |
at com.amazonaws.auth.AbstractAWSSigner.sign(AbstractAWSSigner.java:90) | |
at com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:68) | |
... 14 more | |
Caused by: java.lang.IllegalArgumentException: Empty key | |
at javax.crypto.spec.SecretKeySpec.<init>(SecretKeySpec.java:96) | |
at com.amazonaws.auth.AbstractAWSSigner.sign(AbstractAWSSigner.java:87) | |
... 15 more | |
juil. 25, 2012 10:49:54 AM hudson.slaves.SlaveComputer tryReconnect | |
Infos: Attempting to reconnect CentosVagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"hits":[ | |
{"_index":"logstash-2012.07.26","_type":"dummy","_id":"u5S8Bg2RRo-YutkXuSCoKQ","_score":null, "_source" : {"@source":"file://centos-6-vagrant.vagrantup.com/vagrant_projet/logstash/stacktrace.log" | |
,"@type":"dummy" | |
,"@tags":[] | |
,"@fields":{} | |
,"@timestamp":"2012-07-26T13:35:04.457000Z" | |
,"@source_host":"centos-6-vagrant.vagrantup.com" | |
,"@source_path":"/vagrant_projet/logstash/stacktrace.log" | |
,"@message":"juil. 25, 2012 10:49:46 AM hudson.triggers.SafeTimerTask run\r"},"sort":[1343309704457]}, | |
{"_index":"logstash-2012.07.26","_type":"dummy","_id":"zyeCfYboStC1oofKFMW8-w","_score":null, "_source" : {"@source":"file://centos-6-vagrant.vagrantup.com/vagrant_projet/logstash/stacktrace.log" | |
,"@type":"dummy" | |
,"@tags":["multiline"] | |
,"@fields":{} | |
,"@timestamp":"2012-07-26T13:35:04.474000Z" | |
,"@source_host":"centos-6-vagrant.vagrantup.com" | |
,"@source_path":"/vagrant_projet/logstash/stacktrace.log" | |
,"@message":"Grave: Timer task com.base2services.jenkins.SqsQueueHandler@32eea79d failed\r\ncom.amazonaws.AmazonClientException: Unable to calculate a request signature: Unable to calculate a request signature: Empty key\r\n\tat com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:71)\r\n\tat com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:55)\r\n\tat com.amazonaws.auth.QueryStringSigner.sign(QueryStringSigner.java:83)\r\n\tat com.amazonaws.auth.QueryStringSigner.sign(QueryStringSigner.java:46)\r\n\tat com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:238)\r\n\tat com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:170)\r\n\tat com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:776)\r\n\tat com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:564)\r\n\tat com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:732)\r\n\tat com.base2services.jenkins.SqsProfile.createQueue(SqsProfile.java:72)\r\n\tat com.base2services.jenkins.SqsProfile.getQueueUrl(SqsProfile.java:62)\r\n\tat com.base2services.jenkins.SqsQueueHandler.doRun(SqsQueueHandler.java:37)\r\n\tat hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)\r\n\tat java.util.TimerThread.mainLoop(Timer.java:555)\r\n\tat java.util.TimerThread.run(Timer.java:505)\r\nCaused by: com.amazonaws.AmazonClientException: Unable to calculate a request signature: Empty key\r\n\tat com.amazonaws.auth.AbstractAWSSigner.sign(AbstractAWSSigner.java:90)\r\n\tat com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:68)\r\n\t... 14 more\r\nCaused by: java.lang.IllegalArgumentException: Empty key\r\n\tat javax.crypto.spec.SecretKeySpec.<init>(SecretKeySpec.java:96)\r\n\tat com.amazonaws.auth.AbstractAWSSigner.sign(AbstractAWSSigner.java:87)\r\n\t... 15 more\r"},"sort":[1343309704474]}, | |
{"_index":"logstash-2012.07.26","_type":"dummy","_id":"efd9s2rgTFeNiatd__pofg","_score":null, "_source" : {"@source":"file://centos-6-vagrant.vagrantup.com/vagrant_projet/logstash/stacktrace.log" | |
,"@type":"dummy" | |
,"@tags":[] | |
,"@fields":{} | |
,"@timestamp":"2012-07-26T13:35:04.599000Z" | |
,"@source_host":"centos-6-vagrant.vagrantup.com" | |
,"@source_path":"/vagrant_projet/logstash/stacktrace.log" | |
,"@message":"\r"},"sort":[1343309704599]}, | |
{"_index":"logstash-2012.07.26","_type":"dummy","_id":"xcxgNxRUTb2syet--n3CsQ","_score":null, "_source" : {"@source":"file://centos-6-vagrant.vagrantup.com/vagrant_projet/logstash/stacktrace.log" | |
,"@type":"dummy" | |
,"@tags":[] | |
,"@fields":{} | |
,"@timestamp":"2012-07-26T13:35:04.610000Z" | |
,"@source_host":"centos-6-vagrant.vagrantup.com" | |
,"@source_path":"/vagrant_projet/logstash/stacktrace.log" | |
,"@message":"juil. 25, 2012 10:49:54 AM hudson.slaves.SlaveComputer tryReconnect\r"},"sort":[1343309704610]}, | |
{"_index":"logstash-2012.07.26","_type":"dummy","_id":"WwoynUlNSl6iAMzFw-4gZg","_score":null, "_source" : {"@source":"file://centos-6-vagrant.vagrantup.com/vagrant_projet/logstash/stacktrace.log" | |
,"@type":"dummy" | |
,"@tags":[] | |
,"@fields":{} | |
,"@timestamp":"2012-07-26T13:35:04.631000Z" | |
,"@source_host":"centos-6-vagrant.vagrantup.com" | |
,"@source_path":"/vagrant_projet/logstash/stacktrace.log" | |
,"@message":"Infos: Attempting to reconnect CentosVagrant\r"},"sort":[1343309704631]} | |
]} |
Following pattern is working:
codec => multiline {
pattern => "^[^\[]"
what => "previous"
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks good codec pattern but for stack trace there is a space in between and also different word like ORA- and blank line
java.lang.Exception: And binfilename=TIS_BACARDI_BasisSwapRA_LISP-PRINCIPAL_2017-01-04_Scratt_1483574512000_14_Input.bin.IN09718909L.ISSUE
at sgcib.solstis.persist.service.impl.BinFileHandler.handle(BinFileHandler.java:126) ~[classes/:na]
at sgcib.solstis.persist.service.impl.PersistCallable.call(PersistCallable.java:32) [classes/:na]
at sgcib.solstis.persist.service.impl.PersistCallable.call(PersistCallable.java:13) [classes/:na]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
Caused by: sgcib.solstis.core.exception.SolstisDAOException: Exception occurred while inserting Analysis and BinCache.
at sgcib.solstis.persist.service.SplittedBinsService.insertAnalysisAndBinCache(SplittedBinsService.java:151) ~[classes/:na]
at sgcib.solstis.persist.service.SplittedBinsService.initBinCache(SplittedBinsService.java:106) ~[classes/:na]
at sgcib.solstis.persist.service.impl.BinFileHandler.handle(BinFileHandler.java:106) ~[classes/:na]
... 7 common frames omitted
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("SOLSTIS_LOCAL_BAN"."ANALYSISPROCESS"."COMMANDNAME")
ORA-06512: at line 1
How to read all in single event.Now i see three events
Tried
(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)|(^ORA-06512:.+)
and
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\sCaused by:.+)|(^\sORA-06512:.+)"
not worked