How do you separate multiple clusters logging to the same cloud stack?

Each developer has their own k8s deployment (of the same app). If they all log to cloud loki using the same api key the logs will get all mixed together, right? How do you separate them? Thanks.

I’d use labels as a way to separate the logs coming from different clusters. Have each dev name their namespace differently, and you can then use the namespace name as label.

2 Likes

Separating multiple clusters’ logging in the same cloud stack is essential for clarity and efficiency. Utilize distinct namespaces, labels, or dedicated logging components for each cluster. Configure individual logging pipelines, channels, or streams for seamless separation. Additionally, leverage cloud platform features like resource tagging to organize and distinguish logs effectively.

1 Like

I tried to test this using multiple namespaces from the same machine but I get an error on the second startup:

$ helm install backend ../../backend/ -n ns1 --create-namespace
$ helm install backend ../../backend/ -n ns2 --create-namespace
Error: INSTALLATION FAILED: Unable to continue with install: ClusterRole "promtail" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-namespace" must equal "ns2": current value is "ns1"

Can I not run it like that? Thanks.