Search code examples
kubernetesloggingnginx-ingress

How to Export NGINX Ingress Controller Logs


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?


Solution

  • 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?