0

I have an AKS (Azure Kubernetes) cluster with a few different namespaces. In one of them I have many different pods, each runs only one container.

Azure collects the data and ingest it to Log Analytics.

The problem is that in one of the namespaces I'm running nginx-ingress, which creates a lot of sttout logs.

I want to stop ingesting those logs to the Log Analytics, or even disable them totally (of course that I prefer to keep them in the pod itself).

I could only find a way to disable the entire namespace from collecting the logs, but I need to disable only this specific pod (that been created from a deployment/replicaset).

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
Afik.A
  • 73
  • 1
  • 8

1 Answers1

1

so a reasonable approach would be to put nginx-ingress into a separate namespace and dont gather logs from that namespace at all:

[log_collection_settings.stdout]          
   enabled = true          
   exclude_namespaces = ["kube-system", "nginx-ingress"]

you can edit this configmap:

name: container-azm-ms-agentconfig
namespace: kube-system

Reading:
https://github.com/microsoft/OMS-docker/blob/ci_feature_prod/Kubernetes/container-azm-ms-agentconfig.yaml
https://learn.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-agent-config
https://medium.com/microsoftazure/azure-monitor-for-containers-optimizing-data-collection-settings-for-cost-ce6f848aca32

an alternative, would be to stop ingesting stdout log, only stderr

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Unfortunatley I can't put the ingress on a seperate namespace, it must sit with other pods which I must get their logs. Regarding the second option, is there a way to configure the nginx ingress to ingest only the stderr? (again, the other pods must continue ingesting the stdout as well as the stderr). Thanks, Afik – Afik.A Jul 26 '20 at 07:19
  • no, I've linked all the configuration options. it must not sit with the pods, it can (and should) live in another namespace – 4c74356b41 Jul 26 '20 at 16:49