Google Cloud Login to Google Container / Compute Engine with Go

I have a GKE application with 20 nodes running Go. I would like to merge all the logs for viewing in the Google Developers Console Log Viewer, but I am having two problems. I cannot get severity filtering and every new line in my log message starts a new log entry in the log (problem with new lines in the log).

I have google-fluent-d setup, so all stdout are logged in the cloud, and I used log.Lshortfile, call depth and log.Logger.Output to get the file name and line number from the "log" library.

I looked at this library: "google.golang.org/cloud/logging", but I had problems with its operation.

Is there a library somewhere or an example of a better way to write logs to GKE and GCE?

+4
source share
1 answer

There are a few things you can do, depending on how ambitious you are.

, , , JSON. google-fluentd JSON , API . , severity JSON, JSON () .

( ) , . , , , , . , , - , .

+4

Source: https://habr.com/ru/post/1630093/


All Articles