google-cloud-platformgoogle-cloud-functionsstackdrivergoogle-cloud-stackdriver

Cloud Functions - Remove default logging from StackDriver?


Stackdriver logs a function call for it's execution duration per each call.

Is there a way to in gcloud when during deployment to disable this behavior? My concern is that it will cost a lot since it logs these type of data per each call, and I might have over 10,000+ functions invocations per day.

This is an example playload:

{
 insertId:  "000000-dd134b19-7205-4f3d-84b5-73ba9545b086"  
 labels: {
  execution_id:  "436925802201031"   
 }
 logName:  "projects/PROJECT_NAME/logs/cloudfunctions.googleapis.com%2Fcloud-functions"  
 receiveTimestamp:  "2019-09-23T22:50:08.887292927Z"  
 resource: {
  labels: {…}   
  type:  "cloud_function"   
 }
 severity:  "DEBUG"  
 textPayload:  "Function execution started"  
 timestamp:  "2019-09-23T22:50:07.695418563Z"  
 trace:  "projects/PROJECT_NAME/traces/aa15ea22e311628006a4245b304f182c"  
}

Solution

  • It seems like you are looking for an option to exclude logs from being injected into the Stackdriver Logging.

    If that's the scenario, you might need to use 'Logs exlusions' in-order to exclude the logs.

    On a side note, if you are concerned about total ingested volume, as per the help center article about Tracking logs usage, excluded log volume of the current (on-going) month doesn't includes the same month's ingested log volume.