Why do messages and Error stack trace do not recognize new line charecters


(Sawyer Ford) #1

I would like to know why new lines (\n) are available in the strack trace and why are not getting displayed in a new line. What settings I have to make such that the error stack trace appear with new line as traditional loggers and message also has has all the backslash special charecters ''

{
"@timestamp": "2018-01-27T14:52:36.708+04:00",
"@version": 1,
"message": "Invalid Request Exception: "responsePayload\":\"{\\\"status\\\":\\\"FAIL\\\",\\\"statusCode\\\":1190,\\\"",
"logger_name": "com.json.logging.demo.web.controller.ErrorHandler",
"thread_name": "http-nio-3009-exec-1",
"level": "ERROR",
"level_value": 40000,
"stack_trace": "com.json.logging.demo.exception.PullEmployeeDataException: null\n\tat    
 com.json.logging.demo.web.controller.admin.EmployeeCodeController$ 
$FastClassBySpringCGLIB$$15b35cb5.invoke(<generated>)\n\tat 
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)\n\tat 
org.springframework.aop.framework.CglibAopProxy$ glibAopProxy.java:721)\n\"

 }

I expect the output as below. I expect that the output should omit backslash charecters () and read new lines and spaces (\n\t) and print as below

     {
"@timestamp": "2018-01-27T14:52:36.708+04:00",
"@version": 1,
"message": "Invalid Request Exception: "responsePayload\":\"{ "status ": "FAIL ", "statusCode ":1190,"",
"logger_name": "com.json.logging.demo.web.controller.ErrorHandler",
"thread_name": "http-nio-3009-exec-1",
"level": "ERROR",
"level_value": 40000,
"stack_trace": "com.json.logging.demo.exception.PullEmployeeDataException: null
  at com.json.logging.demo.web.controller.admin.EmployeeCodeController
                $FastClassBySpringCGLIB$$15b35cb5.invoke(<generated>) 
  at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  at  org.springframework.aop.framework.CglibAopProxy$ glibAopProxy.java:721)"

 }

(Magnus Bäck) #2

Instead of describing what you expect, show it! What would you like the JSON object above to look like?


(Sawyer Ford) #3

added the expected output in the description


(Magnus Bäck) #4

What you want to have isn't valid JSON.


(Sawyer Ford) #5

I have added the missing ". what I expect is that the JSON should not have the \n\t charecters inside the stacktrace or inside the message attritubute. I have applied the below config in logstash.conf but it didnt work

 input {
 stdin {
     codec => multiline {
     pattern => "^\s"
     what => "previous"
  }
   }
 }
output { 
stdout { codec => rubydebug } 
}

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.