Correlate cloud function logs by execution

I'm trying to correlate logs to find all logs for a given function execution. These docs say to use the x-cloud-trace-context request header, but I do not see that header anywhere in my logs. However, I do see a field in the root json object of the log entry called "trace" with the structure "projects/<project>/traces/<long hex value>".

Is this what I should use to correlate logs by execution?

0 1 326
1 REPLY 1

Hello @jaredk 

If you do not see the x-cloud-trace-context request header, you can force a request to be traced. You can add the X-Cloud-Trace-Context header to the request. The header specification is:

"X-Cloud-Trace-Context: TRACE_ID/SPAN_ID;o=TRACE_TRUE"

In utilizing X-Cloud-Trace-Context, take a look at viewing and writing Cloud Function logs.

You can also check out the following related materials:

If the above options don't work, you can contact Google Cloud Support to further look into your case. Let me know if it helped, thanks!