Setting a trace id in nginx load balancer

前端 未结 4 671
臣服心动
臣服心动 2021-01-30 11:13

I\'m using nginx as a load balancer in front of several upstream app servers and I want to set a trace id to use to correlate requests with the app server logs. What\'s the bes

4条回答
  •  既然无缘
    2021-01-30 11:41

    In our production environment we do have a custom module like this. It can generate a unique trace id and then it will be pushed into http headers which send to the upstream server. The upstream server will check if the certain field is set, it will get the value and write it to access_log, thus, we can trace the request.

    And I find an 3rd party module just looks the same: nginx-operationid, hope it is helpful.

提交回复
热议问题