Google容器引擎记录到Stackdriver错误报告 [英] Google container engine logging to Stackdriver Error Reporting

本文介绍了Google容器引擎记录到Stackdriver错误报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将错误记录到Google Container Engine中的Stackdriver错误报告。我使用的是GKE内置的基于fluentd的Stackdriver Logging代理,效果很好。但是,当我根据规范记录错误时( https:// cloud.google.com/error-reporting/docs/formatting-error-messages ),我没有看到它出现在Stackdriver错误报告中



有效负载我在Stackdriver Logging中看到

  {
insertId:xatjb4fltv246
jsonPayload:{
流:事件
消息:路径不正确
环境:生产
event_type:RAILS_ERROR
上下文:{
path:/ 2,
reportLocation:{
functionName:foo
filePath:/something.js
lineNumber:3
}
request_id: 3149e5c4-3192-4a9c-a123-b4dedf5a9e07
}
时间戳:1492205840
serviceContext:{
service:nambrotdotcom
}
}
资源:{...}
t imestamp:2017-04-14T21:37:20Z
严重程度:INFO
标签:{...}
logName:projects / nambrotdotcom / logs / web
}

如果我理解正确,那应该没问题?

编辑:

我根据故障排除页面记录了手动错误,并且它工作正常。我在手动记录的错误和从GKE记录的有效负载之间唯一的区别是,日志名称和标签不同,但这不应该是一个因素?

解决方案

错误报告正在查找严重程度错误或更高,但也会考虑 DEFAULT 严重性:INFO
值。


I'm currently trying to log errors to Stackdriver Error Reporting from Google Container Engine. I'm using the built-in fluentd-based Stackdriver Logging agent from GKE which works great. However, when I log an error according to the specification(https://cloud.google.com/error-reporting/docs/formatting-error-messages), I do not see it appear in Stackdriver Error Reporting

The payload I see in Stackdriver Logging is

{
 insertId: "xatjb4fltv246"   
 jsonPayload: {
  stream: "event"    
  message: "path was incorrect"    
  environment: "production"    
  event_type: "RAILS_ERROR"    
  context: {
   path: "/2",
    reportLocation: {
      functionName: "foo"      
      filePath: "/something.js"      
      lineNumber: 3      
    }     
   request_id: "3149e5c4-3192-4a9c-a123-b4dedf5a9e07"     
  }
  timestamp: 1492205840    
  serviceContext: {
   service: "nambrotdotcom"     
  }
 }
 resource: {…}   
 timestamp: "2017-04-14T21:37:20Z"   
 severity: "INFO"   
 labels: {…}   
 logName: "projects/nambrotdotcom/logs/web"   
}

If I understand correctly, this should be fine?

EDIT:

I logged a manual error according to the trouble shooting page and it worked fine. The only difference I see between the error I manually logged and the payload I logged from GKE is that the logname and labels are different, but that shouldn't be a factor?

解决方案

Error Reporting is looking for severity ERROR or higher, but will also consider DEFAULT in most cases. The problem is the severity: "INFO" value in the log entry.

这篇关于Google容器引擎记录到Stackdriver错误报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆