Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Exception not parsed well #236

Open
mooselau opened this issue May 22, 2020 · 2 comments
Open

Java Exception not parsed well #236

mooselau opened this issue May 22, 2020 · 2 comments

Comments

@mooselau
Copy link

mooselau commented May 22, 2020

Hi,

I used "logagent" docker to ship my Java Project logs to sematext cloud, but it seems Java Exceptions(especially in multilines) could not be parsed well. I have tried to add some patterns myself but Exception logs still get multiple records in sematext cloud.

Below is my sample Exception trace:

2020-05-20 16:23:23.088 [scheduling-1] ERROR n.a.processor.agent.AQIUpdateAgent.doUpdating - Failed to update AQI
net.aqimp.exception.InternalException: Failed to send request
        at net.aqimp.processor.agent.AQIFetchAgent.fetchAQI(AQIFetchAgent.java:81)
        at net.aqimp.processor.agent.AQIUpdateAgent.doUpdating(AQIUpdateAgent.java:51)
        at net.aqimp.controller.ServiceScheduler.regularlyUpdateAQI(ServiceScheduler.java:24)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        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:748)
Caused by: net.aqimp.exception.CommunicationException: Failed to send request to URL
        at net.aqimp.processor.communication.AQIHttpRequestHandler.proceedRequest(AQIHttpRequestHandler.java:87)
        at net.aqimp.processor.agent.AQIFetchAgent.fetchAQI(AQIFetchAgent.java:72)
        ... 15 common frames omitted
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:171)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
        at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593)
        at sun.security.ssl.InputRecord.read(InputRecord.java:532)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:990)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1388)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1416)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1400)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:352)
        at net.aqimp.processor.communication.AQIHttpRequestHandler.proceedRequest(AQIHttpRequestHandler.java:69)
        ... 16 common frames omitted

And one normal log sample:

2020-05-20 16:23:23.088 [scheduling-1] INFO  n.a.p.c.AQIHttpRequestHandler.proceedRequest - AQI server is querying

And my adding patterns in patterns.yml:

patterns:                                                                       
 - sourceName: !!js/regexp server.log
   match:                            
     - type: log_common              
       regex: !!js/regexp ^(([\d|\-|\:|.|\s]+)\s(\[.+\])\s([A-Z]+)\s(.+)-(.+))
       fields: [raw, ts, thread, severity, logger, message]                   
       dateFormat: yyyy-MM-dd HH:mm:ss.SSS                                    
                                                                               
 - sourceName: !!js/regexp server.log                                           
   blockStart: !!js/regexp ^(\S.+Exception:.+)         
   match:                                     
     - type: log_trace                        
       regex: !!js/regexp ^(\S.+Exception:.+\n\s+.*)
       fields: [stacktrace]

The trace look in sematext logs panel, and I wish to see one record in sematext logs but with the whole exception stack:
image

@otisg
Copy link
Member

otisg commented May 22, 2020

For your Java stack traces -- I assume that is not the complete stack trace. For example, I don't see the timestamp.

@mooselau
Copy link
Author

Hi @otisg , updated the stack traces, there is one ERROR log above the stack traces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants