I have not found a way to add default summary fields to Log Explorer.
My situation is this:
With Gen1 Cloud Functions, the Function Name is in the default summary and in the Log Fields Pane on the left, when there are corresponding log entries in the current query results.
Since moving to Gen2 Functions, I have to add resource.labels.service_name to the Custom Summary Fields whenever I open a new Log Explorer window if I want to see the service/origin of log lines. (Since I have several functions with a partially shared codebase, the context is not obvious from the message itself.)
Does anyone have a hint how to improve this? This makes me regret moving to Gen2 Functions as of now…
There is not a specific setting in Google Cloud Run to “enable resource.labels.service_name by default”. But Logs Explorer offers default summary fields and custom summary fields. Default summary fields depend on your current query results.
To view your Gen2 Cloud Function logs in the Cloud Logging, click the resourceCloud Run Revision for a service, or Cloud Run Job for a job.
As for new updates of Google Cloud release notes, Cloud Functions has been recently renamed to Cloud Run Function. This change might be helpful when searching for documentation or updates.
Thanks for your comprehensive answer. It unfortunately seems to confirm what I already feared. I can’t modify default summary fields to apply on any new log explorer window for a given project or otherwise.
The problem arises when looking at logs for all of the functions in total, trying to find if there are patterns. With gen1 Functions, the default fields where shown on the left hand ‘Log Fields Pane’ with numbers showing the sum of log entries for the specific function.
Now we’ll have to create extra monitoring metrics for this, I suppose.
I will have a look at the requested feature you mentioned. Thank you!