Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View response body on Google Cloud Scheduler logs

This article says to simply click view under the Logs column to see the output of Google Cloud Scheduler logs. However, while I can see the status code of a HTTP scheduled function, I cannot see the response. For instance, this request normally returns an array of objects, but this was the full log I got back from the Cloud Scheduler:

{
 httpRequest: {
  status:  200   
 }
 insertId:  "------"  
 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished"   
  jobName:  "projects/----/locations/us-west2/jobs/name"   
  targetType:  "HTTP"   
  url:  "http://endpoint.com/test"   
 }
 logName:  "projects/----/logs/cloudscheduler.googleapis.com%2Fexecutions"  
 receiveTimestamp:  "2019-07-18T16:00:12.574419040Z"  
 resource: {
  labels: {
   job_id:  "Name"    
   location:  "us-west2"    
   project_id:  "----"    
  }
  type:  "cloud_scheduler_job"   
 }
 severity:  "INFO"  
 timestamp:  "2019-07-18T16:00:12.574419040Z"  
}

How can I also view the response object/ text from a Cloud Scheduler request?

like image 961
user1222324562 Avatar asked Jul 18 '19 16:07

user1222324562


1 Answers

How can I also view the response object/ text from a Cloud Scheduler request?

Stackdriver does not log the HTTP Response body.

You will need to log to Stackdriver the HTTP Response that your function sends. This means addition Stackdriver functionality to your function code.

This link includes Stackdriver examples:

Logging Client Libraries

like image 144
John Hanley Avatar answered Sep 21 '22 11:09

John Hanley