Closed svaroop closed 4 years ago
What is the expected behavior, and what is the behavior you're seeing? Is there an error?
From Rest API () , we are getting following response
{
"entries": [
{
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {},
"authenticationInfo": {
"principalEmail": "xxxxxx@xxxxxx.com"
},
"requestMetadata": {
"callerIp": "x.x.x.x",
"callerSuppliedUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36,gzip(gfe)"
},
"serviceName": "cloudresourcemanager.googleapis.com",
"methodName": "CreateProject",
"resourceName": "projects/xxxxxx",
"request": {
"project": {
"projectNumber": "xxxxxx",
"projectId": "xxxxxx",
"lifecycleState": "ACTIVE",
"name": "xxxxxx",
"createTime": "2019-12-26T13:53:52.607Z"
}
}
},
"insertId": "lxoiatd14xxxxxx",
"resource": {
"type": "project",
"labels": {
"project_id": "xxxxxx"
}
},
"timestamp": "2019-12-26T13:53:56.477Z",
"severity": "NOTICE",
"logName": "projects/cgyaccess/logs/cloudaudit.googleapis.com%2Factivity",
"receiveTimestamp": "2019-12-26T13:53:56.552539587Z"
}
]
}
But from sdk using code specified earlier, we are getting response as
&{type_url:"type.googleapis.com/google.cloud.audit.AuditLog" value:"\022\000\032\026\n\024c@ctc.com\"\032\n\0170:0:0:0:0:0:0:1\022\007unknown: servicemanagement.googleapis.comB?google.api.servicemanagement.v1.ServiceManager.ActivateServicesJI\n$services/cloudbilling.googleapis.com\022\037servicemanagement.services.bind\030\001JH\n&projectnumbers/215747733144/services/-\022\034serviceusage.services.enable\030\001JH\n&projectnumbers/215747733144/services/-\022\034serviceusage.services.enable\030\001JJ\n$services/cloudbilling.googleapis.com\022\"servicemanagement.services.bindAllJi\n;services/cloudbilling.googleapis.com/consumers/215747733144\022*serviceconsumermanagement.consumers.enableZ<projects/215747733144/services/[cloudbilling.googleapis.com]\202\001\255\001\n \n\021consumerProjectId\022\013\032\tcgyaccess\n1\n\014serviceNames\022!2\037\n\035\032\033cloudbilling.googleapis.com\nV\n\005@type\022M\032Ktype.googleapis.com/google.api.servicemanagement.v1.ActivateServicesRequest\212\001\323\001\nx\n\010settings\022l2j\nh*f\n,\n\013serviceName\022\035\032\033cloudbilling.googleapis.com\n6\n\rusageSettings\022%*#\n!\n\024consumerEnableStatus\022\t\032\007ENABLED\nW\n\005@type\022N\032Ltype.googleapis.com/google.api.servicemanagement.v1.ActivateServicesResponse" }
As you can see, we are getting lot of invalid characters (such as \022\000\032\026\n\024 ) in value response .
Not sure why that's happening. Are these the same logging entry? Does it happen consistently? What environment?
Yes , Both are same entries. first response is from REST API and second response is from Go sdk. it is happening consistently in ubuntu environment.
When you call resp.GetPayload()
what gets returned is a isLogEntry_Payload
. In this case isLogEntry_Payload
is a LogEntry_ProtoPayload
. The unrecognized bits are apart of the proto encoding I believe.
Closing due to lack of response. Please reopen if you still have questions.
Package : cloud.google.com/go/logging/apiv2
Code :
Response :