0

I need to analyze the traffic to my K8s cluster (Not a Managed Cluster), so I need to export the logs.

NGINX logs are easy to export but NGINX Ingress Controller is new to me.

I am trying to find a solution on how to do this, but couldn't find it in the NGINX documentation.

Does anyone have an idea?

Toby T
  • 43
  • 1
  • 6

1 Answers1

1

You can retrieve the logs of the nginx ingress controller pod by simply using the command:

kubectl logs <nginx-ingress-controller-pod> -n <namespace>

If you want to export it, you just redirect the output of kubectl logs to a file:

kubectl logs <nginx-ingress-controller-pod> -n <namespace> > nginx-ingress-controller-pod.log

Would this solve your problem?

rock'n rolla
  • 1,883
  • 1
  • 13
  • 19
  • Mostly the ingress nginx controller is running in more than one replica. So it might be helpful to get the logs from the all pods https://stackoverflow.com/questions/33069736/how-do-i-get-logs-from-all-pods-of-a-kubernetes-replication-controller – k0chan Apr 25 '23 at 09:39
  • Not in the setup we have. But yeah, the `--all-containers` flag is an option in that case. – rock'n rolla Apr 25 '23 at 09:45
  • 1
    I can't believe I didn't think of this. It worked. Thanks! – Toby T Apr 26 '23 at 16:54