Is it possible to stream GKE logs to multiple GCP project StackDrivers

11/20/2019

I am looking to split the logs on the StackDriver Agent (SDA) to multiple GCP projects (StackDrivers) based on some filter. By default SDA targets GCP project where resides. There is a SDA configuration option, to setup different GCP destination project id, but only one.

SDA as a FluentD wrapper uses for the match section, type google_cloud.

Does this mean that the only solution is to write a custom FluentD filter that rely on the google_cloud and targets multiple GCP projects?

Thanks

-- Rastko
google-cloud-platform
google-cloud-stackdriver
google-kubernetes-engine

2 Answers

11/20/2019

If you write your own Stackdriver logger, you can do anything you want.

The Google Stackdriver logging (the driver) does not support streaming parts of logs to different Stackdriver Logs (the service).

-- John Hanley
Source: StackOverflow

11/21/2019

First of all, you can not split logs on Stackdriver Monitoring Agent to send in different GCP project’s Stackdrivers based on any filter. I understand that you went through the document [1] and want to be confirmed about the option “type google_cloud”.

Here, the configuration options will let you override LogEntry labels [2] and MonitoredResource labels [3] when ingesting logs to Stackdriver Logging and “type google_cloud” for cloud resources of all types.

[1]:- https://cloud.google.com/logging/docs/agent/configuration#label-setup

[2]:- https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry

[3]:- https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource

-- Shafiq I
Source: StackOverflow