当我使用输出 cat 运行journalctl时,它会按预期打印整个异常堆栈跟踪。 运行带有输出 json 的journalctl,它会跳过第一行:
[root@doc-test-node01 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会跳过第一行:
[root@doc-test-node01 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 :(得分:0)
我发现的是我不应该贪图。 journalctl无法创建第一行的json并打印数字,这意味着该消息存在:
"MESSAGE" : [ 27, 91, 48, ...