Override requestid or set a value of the mapped diagnostic context for elasticsearch?


(Johan) #1

Is it possible to override or set request_id in logging?
We are using MDC, Mapped Diagnostic Context, to set a transaction/context id, such as every request logs a transaction log.
But the few times there is a log message from elasticsearch, this is done in another thread and there is no transaction id.
Or if it's possible to use an supplier that sets the transaction id in a thread?

Checked the code, found out that the requestid is set in the transport interface. But didnt find a good way of how to oveeride it.

[elasticsearch[client][generic][T#4]] INFO o.e.c.t.TransportClientNodesService failed to get node info for {#transport#-2}{q6...}{...}{...}, disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][...][cluster:monitor/nodes/liveness] request_id [49078] timed out after [5000ms]
at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:908)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:527)
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)


(system) #2

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