简体   繁体   中英

Changing the header of Stackdriver Logging logs in GCP

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:

1

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 :

  • click on View options (top-right corner, near Download logs )
  • choose Modify custom fields
  • add your fields as custom fields : jsonPayload.userName,jsonPayload.userMail

Once refreshed, the web page should display your fields at the right of the timestamp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM