Hi all,
I have k8s cluster internal , I installed loki , grafana , promtail by helm
helm -n monitoring install loki grafana/loki -f loki-values.yaml
loki-values.yaml
loki:
auth_enabled: false
commonConfig:
replication_factor: 1
storage:
type: 'filesystem'
filesystem:
volumeClaimTemplate:
spec:
storageClassName: storageclass-csi-nfs-sgnnas03
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
monitoring:
serviceMonitor:
enabled: false
selfMonitoring:
enabled: false
tableManager:
enabled: true
retention_deletes_enabled: true
retention_period: 720h
singleBinary:
replicas: 1
helm -n monitoring install promtail grafana/promtail -f promtail-values.yaml
promtail-values.yaml
config:
# publish data to loki
clients:
- url: http://loki-gateway/loki/api/v1/push
tenant_id: 1
They work fine but as default promtail will get logs from all pod in all namespace and store logs in loki.
I want to config loki+promtail so they get logs from specific namespaces (for ex namespace1 & namespace2) only and store logs in loki.
So from grafana → explore can only query filter label namespace=namespace1 and view logs of pods in namespace1 , cannot query filter label namespace=cert-manager or kube-system.
Is it feasible? Please give me some advice , thank you very much.