View response body on Google Cloud Scheduler logs
J

2

7

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?

Jotter answered 18/7, 2019 at 16:47 Comment(1)
You will need to log to Stackdriver the HTTP Response that your code sends within your code. Stackdriver does not log the HTTP Response body.Wold
W
2

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

Wold answered 20/7, 2019 at 0:23 Comment(0)
H
0

Cloud Scheduler discards the response body. Maybe someday they will correct this oversight.

Harsho answered 30/7 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.