如何向 Traefik 添加唯一的请求 ID 标头 [英] How to add a unique request ID header to Traefik

查看:47
本文介绍了如何向 Traefik 添加唯一的请求 ID 标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Traefik 中,是否可以为请求添加唯一的请求 ID 标头?我希望能够将访问日志与后端服务的日志相关联.

In Traefik, is it possible to add a unique Request ID header to requests? I'd like to be able to correlate access logs with logs from backend services.

推荐答案

AFAIK 不支持它,但这是 Traefik 2.3.6 中的一个功能性解决方法:

AFAIK there is no support for it, however here is a funcional workaround in Traefik 2.3.6:

# static config

...

[tracing]
  # Workaround for the non support of Correlation/Request Id Header
  # - https://github.com/traefik/traefik/issues/4640
  # - https://github.com/traefik/traefik/pull/6707#issuecomment-640429009
  [tracing.jaeger]
    samplingParam = 0
    traceContextHeaderName = "X-Correlation-Id"

...

这篇关于如何向 Traefik 添加唯一的请求 ID 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆