GCP 日志记录控制台不显示某些 GKE 日志消息



我在GCP中有K8S集群(版本为1.20.8-gke.900)从常规更新通道)。所有集群pod在STDOUT中写入日志或STDERR

我发现一些日志信息从来没有出现在GCP日志控制台。

例如:

{
"severity": "INFO",
"timestamp": "2021-08-18T09:38:34.016614425Z",
"caller": "dbscan/dbscan.go:82",
"message": "Query",
"method": "GET",
"uri": "/api/v1/test",
"path": "/api/v1/test",
"correlation-id": "2021435824-1629279514010580579-448",
"rowCount": 4,
"pid": 679135,
"sql": "SELECT id FROM test WHERE name = ANY($1::varchar[])",
"args": [
[
"aaa",
"bbb",
"ccc",
"ddd"
]
],
"time": 3282419,
"logging.googleapis.com/labels": {},
"logging.googleapis.com/sourceLocation": {
"file": "/go/pkg/mod/github.com/georgysavva/scany@v0.2.4/dbscan/dbscan.go",
"line": "82",
"function": "github.com/georgysavva/scany/dbscan.processRows"
}
}
但是,我可以通过kubectl

在GKE控制台中看到上述消息效用。同时,我可以在GCP日志中看到下面的日志消息:

{
"severity": "INFO",
"timestamp": "2021-08-18T09:41:48.695923055Z",
"caller": "puddle@v1.1.1/pool.go:470",
"message": "Dialing PostgreSQL server",
"host": "0.0.0.0",
"logging.googleapis.com/labels": {},
"logging.googleapis.com/sourceLocation": {
"file": "/go/pkg/mod/github.com/jackc/puddle@v1.1.1/pool.go",
"line": "470",
"function": "github.com/jackc/puddle.(*Pool).constructResourceValue"
}
}

我不明白是什么阻止了GCP日志控制台显示此消息…

我已经尝试过复制,并且可以在删除" time "字段(不是" timestamp ")后定期获得JSON片段日志。我怀疑"时间"字段中的值格式("time": 3282419)不匹配导致日志不能在云日志记录中生成。参考时间相关字段获取信息。

相关内容

  • 没有找到相关文章

最新更新