You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Anil K <se...@gmail.com> on 2020/12/02 06:22:09 UTC

Tracking ID in log4j MDC

Hi All,

Is it possible to have a tracking id in MDC that will be shared across
chained users defined operations like Filter, KeySelector, Flat map,
Process function, and  Producer?

Tracking id will be read from headers of Kafka Message, which if possible
plan to set to MDC in log4j. Right now I am seeing tracking id is not
getting propagated to the next function.

I am using flink 1.9 running in k8.

Thanks, Anil

Re: Tracking ID in log4j MDC

Posted by Till Rohrmann <tr...@apache.org>.
Hi Anil,

Flink does not maintain the MDC context between threads. Hence, I don't
think that it is possible w/o changes to Flink.

One note, if operators are chained then they are run by the same thread.

Cheers,
Till

On Wed, Dec 2, 2020 at 7:22 AM Anil K <se...@gmail.com> wrote:

> Hi All,
>
> Is it possible to have a tracking id in MDC that will be shared across
> chained users defined operations like Filter, KeySelector, Flat map,
> Process function, and  Producer?
>
> Tracking id will be read from headers of Kafka Message, which if possible
> plan to set to MDC in log4j. Right now I am seeing tracking id is not
> getting propagated to the next function.
>
> I am using flink 1.9 running in k8.
>
> Thanks, Anil
>