问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/43451973/google-container-engine-logging-to-stackdriver-error-reporting