2015-10-29 72 views
0

當我運行journalctl與輸出它按預期打印整個異常堆棧跟蹤。 與輸出JSON運行journalctl,它跳過第一行:爲什麼journalctl的json輸出不打印整個異常堆棧跟蹤?

[[email protected] splunk]# journalctl -f -o cat | grep undertow 

13:35:31,858 ERROR [io.undertow.request] [bruker=01026300394 korrId=826gg6c45 kallId=826y7otah] (default task-62) Undertow request failed HttpServerExchange{ POST /startlan-esoknad/soknader/}: java.lang.NullPointerException 
     at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:171) 
     at io.undertow.servlet.spec.ServletInputStreamImpl.close(ServletInputStreamImpl.java:245) 
     at io.undertow.servlet.spec.HttpServletRequestImpl.closeAndDrainRequest(HttpServletRequestImpl.java:602) 
     at io.undertow.servlet.core.ServletBlockingHttpExchange.close(ServletBlockingHttpExchange.java:87) 
     at io.undertow.server.HttpServerExchange.endExchange(HttpServerExchange.java:1444) 
     at io.undertow.server.Connectors.executeRootHandler(Connectors.java:213) 
     at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) 

當我運行journalctl -f -o json-pretty | grep undertow然後journalctl跳過第一行:

[[email protected] splunk]# journalctl -f -o json-pretty | grep undertow 

     "MESSAGE" : "\u0009at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:171)", 
     "MESSAGE" : "\u0009at io.undertow.servlet.spec.ServletInputStreamImpl.close(ServletInputStreamImpl.java:245)", 
     "MESSAGE" : "\u0009at io.undertow.servlet.spec.HttpServletRequestImpl.closeAndDrainRequest(HttpServletRequestImpl.java:602)", 
     "MESSAGE" : "\u0009at io.undertow.servlet.core.ServletBlockingHttpExchange.close(ServletBlockingHttpExchange.java:87)", 
     "MESSAGE" : "\u0009at io.undertow.server.HttpServerExchange.endExchange(HttpServerExchange.java:1444)", 
     "MESSAGE" : "\u0009at io.undertow.server.Connectors.executeRootHandler(Connectors.java:213)", 
     "MESSAGE" : "\u0009at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)", 

它也將跳過輸出JSON和第一線JSON-SSE。

回答

0

我發現的是我不應該grep。 journalctl無法創建第一行的json,而是打印出數字,表示該消息存在:

"MESSAGE" : [ 27, 91, 48, ...