GCP stackdriver logging logs format changed in bucket from folder per container to stdout\stderr

こ雲淡風輕ζ 提交于 2021-01-28 09:16:13

问题


i have a question, similar as describe here: GKE kubernetes container stdout logs format changed

in old version of stackdriver i had 1 sink with filter like this:

resource.type=container,
resource.namespace_id=[NAMESPACE_NAME] 
resource.pod_id=[POD_NAME]

and logs was stored in bucket pretty well, like this:

logName=projects/[PROJECT-NAME]/logs/[CONTAINER-NAME]

...so i had folders whith logs for each container.

But now i updated my stackdriver logging+monitoring to last version and now i have 2 folders stdout\stderr which contains all logs for all containers!

logName=projects/[PROJECT-NAME]/logs/stdout
logName=projects/[PROJECT-NAME]/logs/stderr

All logs from many containers stored in this single folders! This is pretty uncomfortable =(

I'v read about this in docs: https://cloud.google.com/monitoring/kubernetes-engine/migration#changes_in_log_entry_contents

The logName field might change. Stackdriver Kubernetes Engine Monitoring log entries use stdout or stderr in their log names whereas Legacy Stackdriver used a wider variety of names, including the container name. The container name is still available as a resource label.

...but i can't find solution! Please, help me, how to make container per folder logging, like it was in old version of stackdriver?


回答1:


Here is a workaround that has been suggested:

  1. Create a different sink for each of your containers filtered by resource.labels.container_name
  2. Export each sink to a different bucket

Note: If you configure each separate sink to the same bucket the logs will be combined.

More details at Google Issue Tracker



来源:https://stackoverflow.com/questions/60177065/gcp-stackdriver-logging-logs-format-changed-in-bucket-from-folder-per-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!