Multitenancy - promtail how to scrape only certain namespaces/apps

Currently, we run our kubernetes application in a cluster with the EFK (Elastic Search, Fluent-bit, and Kibana) stack. Our application is comprised of multiple pods/services but there are no other applications running in the cluster (except for native Kubernetes and the EFK stack).

When we deliver to our customer, we will be deploying to a multi-tenant cluster where our application will be running in the same cluster as other applications. Our application needs to provide it’s own logging solution (we only care about logs associated with our application) but fluent-bit currently scrapes any pods running in the cluster.

I am looking into Loki for log collection and visualization. Is there a way that I can deploy loki and configure it to only scrape logs associated with our application (via an annotation, label, etc.)?

In preparation for helping our customer, I would like to understand how to deploy Loki in a multi-tenant way and then configure it to only scrape our application. Then as we understand and learn how it works, we can educate our customer how they can configure logging for other applciations running in their cluster. Is there a way to configure promtail to only scrape logs from certain namespaces, with specific labels/annotations, etc.

Hi Team,

we are new to loki and trying to implement it in aws cluster expecting to get logs from all apps running in different namespaces. But all namespaces/apps are not showing up in Grafana.

I am using the loki and promtail helm files from below link.

Any suggestions?