Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Log Explorer default summary fields: function name for Gen2 Cloud Functions

Hi all

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...

Any help is appreciated!

Solved Solved
0 2 1,049
1 ACCEPTED SOLUTION

Hi @jw_x_bf,

Welcome to Google Cloud Community.

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 resource Cloud Run Revision for a service, or Cloud Run Job for a job.

As shared by @Sander van den Oord in the Stack Overflow post, the Gen2 Cloud Function now uses Cloud Run. You might try Cloud Run logs for specific revision and services or read logs in the command line directly from Cloud Logging

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.

Also, there is already an ongoing feature request to Enable Cloud Run "resource.labels.service_name" by default within Cloud Logging. However, I can’t give a specific date as to when this will be implemented.

I hope the above information is helpful.

View solution in original post

2 REPLIES 2

Hi @jw_x_bf,

Welcome to Google Cloud Community.

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 resource Cloud Run Revision for a service, or Cloud Run Job for a job.

As shared by @Sander van den Oord in the Stack Overflow post, the Gen2 Cloud Function now uses Cloud Run. You might try Cloud Run logs for specific revision and services or read logs in the command line directly from Cloud Logging

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.

Also, there is already an ongoing feature request to Enable Cloud Run "resource.labels.service_name" by default within Cloud Logging. However, I can’t give a specific date as to when this will be implemented.

I hope the above information is helpful.


@ChieKo wrote:

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

 


Hey ChieKo

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!