I am currently working on a GAS project with a lot of consol.log
, but it's a project which will be deployed.
Is it possible to have a userName
or a userMail
in the header of a GCP Stakdriver Logging log entry, next to the date and time?
Here's the part I'm referring to:
Thank you for your answers.
You can't directly modify the header (it will always contain only the timestamp of the log), but you can add custom fields next to it.
First, you have to include the fields you want to display (userName
and userMail
) in your entry log. You can include that in the jsonPayload
field of the log entry (see the docs of Structured Logging). Once done, assuming that your fields are jsonPayload.userName
and jsonPayload.userMail
, you can do the following on Stackdriver Logging page in the Google Console :
jsonPayload.userName,jsonPayload.userMail
Once refreshed, the web page should display your fields at the right of the timestamp.