[英]How get GCP Error Reporting from Java App running on GKE ( google kubernetes engine )
in case of Java App Engine, if exception occur from Java App, i can get GCP Error reporting automatically like this在 Java App Engine 的情况下,如果 Java App 发生异常,我可以像这样自动获得 GCP 错误报告
But in case of Java App on GKE, i can't get GCP Error Reporting但是对于 GKE 上的 Java App,我无法获得 GCP 错误报告
How does it can?怎么可以?
you should install Stackdriver Kubernetes Monitoring to GKE;您应该将Stackdriver Kubernetes Monitoring安装到 GKE; while one can also use it together with Prometheus .同时也可以与Prometheus一起使用。 theses features are currently still in beta stage (not being covered by any SLA).这些功能目前仍处于测试阶段(未被任何 SLA 覆盖)。 also see the Fluentd data collector, which is rather relevant to the Logging API
.另请参阅Fluentd数据收集器,它与Logging API
相当相关。 this visual diagram might explain the most reliable who reports to whom:这个可视化图表可以解释谁向谁报告最可靠:
this one SLF4J example shows how log from within a Java environment, there there's relevant documentation for Logging Application Events with Java (what you might be actually looking for).这个SLF4J 示例展示了如何从 Java 环境中进行日志记录,有使用 Java 记录应用程序事件的相关文档(您可能正在寻找的内容)。 in principle, the logger within the Java environment needs to tell the local agent, what is going on.原则上,Java 环境中的记录器需要告诉本地代理,发生了什么。
concerning the Logging API
in Kubernetes, see Logging Using Stackdriver and Customizing Stackdriver Logs for Kubernetes Engine with Fluentd ;关于 Kubernetes 中的Logging API
,请参阅使用Stackdriver 进行日志记录和使用 Fluentd 为 Kubernetes Engine 自定义 Stackdriver 日志; there is more than one way to do that.有不止一种方法可以做到这一点。
the Monitoring API
and the Logging API
can be used independently, while they nevertheless observe the same resources and the same timeline, that's why utilizing both makes sense. Monitoring API
和Logging API
可以独立使用,但它们观察相同的资源和相同的时间线,这就是为什么同时使用两者是有意义的。
concerning the access scope required:关于所需的访问范围:
You must be an Owner of the project containing your cluster.您必须是包含集群的项目的所有者。
As mentioned in the doc Stackdriver Error Reporting is automatically enabled for App Engine environment applications.正如文档中提到的,Stackdriver 错误报告会自动为 App Engine 环境应用程序启用。 However on GKE, you must add the cloud-platform access scope when creating the cluster.但是在 GKE 上,您必须在创建集群时添加云平台访问范围。 The preferred way to collect the error is to able to post to Stackdriver Error Reporting using the REST API or Error Reporting Client Libraries收集错误的首选方法是能够使用REST API或错误报告客户端库发布到 Stackdriver 错误报告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.