我在从google-cloud-logging ruby gem查找日志时遇到问题。
我可以通过我的谷歌云控制台使用高级搜索找到这些日志:jsonPayload.requestId=875325619
它返回多个结果,一个基本示例:
{
insertId: "epfh5dffj67k5"
jsonPayload: {
requestId: 875325619
request: {…}
timeSeconds: 5.296060973778367
}
resource: {
type: "gce_instance"
labels: {…}
}
timestamp: "2017-05-08T19:31:20.145488859Z"
severity: "WARNING"
logName: "projects/myproject/logs/mylog"
}
然而,通过 ruby 代理,这将返回一个空数组:
logging = Google::Cloud::Logging.new
logging.entries filter: "jsonPayload.requestId=875325619"
=> []
但是,寻找我发送的不同日志消息有效:
logging.entries filter: 'jsonPayload.uploadKey="example"'
[#<Google::Cloud::Logging::Entry:0x00000008e6ea30 (data here)>]
该数据如下所示:
{
insertId: "8w81fbg2a077zl"
jsonPayload: {
processingTime: 0.79228602
uploadType: "type"
uploadKey: "example"
}
resource: {
type: "gce_instance"
labels: {…}
}
timestamp: "2017-05-08T18:58:11Z"
labels: {…}
logName: "projects/myproject/logs/otherapp"
}
为什么我可以找到一组日志消息而找不到另一组?