Google Cloud Functions: monitor HTTP status codes [closed]

不问归期 提交于 2021-01-28 11:20:31

问题


I want to setup Cloud Monitoring to alert me each time my Cloud Function responds with 4xx / 5xx HTTP status codes. Please let me know how to implement this from Cloud Console.


回答1:


You can use Cloud Logging for this.

  • Go to the Cloud Logging page and filter your logs
  • Then select the part of the logs that you want (in my screen shot is the 200 HTTP response code), and click on "show matching entries"

  • Now, in the query builder, you have the matching entry that you select

You can change it, the value (400 instead of 200) the equality by > or <,... So, you can see in the documentation how to build a Cloud Logging filter

  • Then go to Action and click on create metrics

  • Now create your metric and name it.

  • Finally, click on the 3 dots on the right and select create an alert on this metric

  • From there, follow the wizard. Name your condition, define your threshold and notification channels. I think it's the easiest part (but if you need guidance, let me know)


来源:https://stackoverflow.com/questions/65092493/google-cloud-functions-monitor-http-status-codes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!