jam-it-nl / JamLogSplunk

Apache License 2.0
0 stars 0 forks source link

Error using module #1

Open robalexclark opened 2 years ago

robalexclark commented 2 years ago

Hello,

We are trying to use your module to send Mendix logs to splunk but are getting the following error:

11:28:26 AMAPPERRORJamLogSplunk: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10 path $ 11:28:26 AMAPPERRORJamLogSplunk: com.splunk.logging.HttpEventCollectorErrorHandler$ServerErrorException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10 path $ 11:28:26 AMAPPINFOat com.splunk.logging.HttpEventCollectorSender$3.failed(HttpEventCollectorSender.java:400) 11:28:26 AMAPPINFOat com.splunk.logging.HttpEventCollectorSender$4.onFailure(HttpEventCollectorSender.java:444) 11:28:26 AMAPPINFOat okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525) 11:28:26 AMAPPINFOat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 11:28:26 AMAPPINFOat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 11:28:26 AMAPPINFOat java.base/java.lang.Thread.run(Unknown Source)

This happens both in local dev and deployed mendix app.

Any ideas?

martijnraats commented 2 years ago

Hello,

The library is expecting a JSON message from the splunk server, but receiving something else, most likely an error message. Unfortunately the response body is not logged.

You could debug the onError method (line 104 on jamlogsplunk/actions/RegisterLogSubscriber.java) to find out the exact response.

Or add something like this:

  String message = exception.getMessage();
  if (exception instanceof HttpEventCollectorErrorHandler.ServerErrorException) {
    message += ", reply = " + ((HttpEventCollectorErrorHandler.ServerErrorException) exception).getReply();
  }

Regards Martijn