user1808266
user1808266

Reputation: 61

Linking log4j logs and zipkin trace id

I have a system where we have 2 modules.

1) Module 1 is a webapp with multiple endpoints, deployed on Tomcat. 2) Module 2 is an executable jar,(not a web-app) which spins up 2 Kafka consumers (K1 and K2) listening to topic1 and topic2 respectively.

The web-app (Module 1) pushes messages to topic1. K1 listens to topic1.It receives messages, processes them and pushes the processed messages to topic2. K2 listens to topic2. The messages are fully processed by K2 and do not propagate further.

There are multiple points where errors can occur in this flow. I wanted to use Zipkin/ Jaegar to trace the entire flow, and also link the logs to the trace id, so that any issue can be easily and quickly investigated.

Can anyone suggest me the way to go forward?

Upvotes: 1

Views: 963

Answers (1)

jramapurath
jramapurath

Reputation: 261

You can add the trace id in your logback.xml

"request_id": {"trace_id":"%X{X-B3-TraceId}","span_id":"%X{X-B3-SpanId}","parent_span_id":"%X{X-B3-ParentSpanId}"},

Upvotes: 1

Related Questions