i'm using nginx load balancer in front of several upstream app servers , want set trace id use correlate requests app server logs. what's best way in nginx, there 3rd party module this?
otherwise pretty simple way base off of timestamp (possibly plus random number if that's not precise enough) , set header on request, set_header command see in docs setting response header.
in cases don't need custom module, can set header combination of embedded variables of http_core_module (most probably) unique. example:
location / { proxy_pass http://upstream; proxy_set_header x-request-id $pid-$msec-$remote_addr-$request_length; } this yield request id "31725-1406109429.299-127.0.0.1-1227" , should "unique enough" serve trace id.
Comments
Post a Comment