Log to stdout/stderr

Hi,

Not sure what is happening, but our Kubernetes deployment is not sending Kong logs to stdout/stderr. I believe the same problem is happening with the standard Kong Kubernetes deployment with charts. Is there anything else other than setting environment variables to redirect the logs?

Environment variables:
KONG_ADMIN_LISTEN: 0.0.0.0:8001
KONG_ADMIN_LISTEN_SSL: 0.0.0.0:8444
KONG_PROXY_LISTEN: 0.0.0.0:8000
KONG_PROXY_LISTEN_SSL: 0.0.0.0:8443
KONG_NGINX_DAEMON: off
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_LOG_LEVEL: debug
KONG_PG_DATABASE: kong
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
KONG_NGINX_WORKER_PROCESSES: auto

Regards,
Luiz

How you starting Kong? Kong needs to run as nginx process to send log to stdout/stderr.

I see. No, I’m just calling kong start. But isn’t is also what the current K8s chart files are doing? I don’t have access to minikube now or our K8s cluster to try it. Do you see the logs being redirected with the charts in Kong’s GitHub repo?

Regards,
Luiz

No, as we are not explicitly calling cmd in the chart and let the Dockerfile handle it,.

Also I was referring to the chart https://github.com/kubernetes/charts/pull/3150, but you can run Kong as nginx process in your existing chart by running

“kong prepare -p /usr/local/kong && /usr/local/openresty/nginx/sbin/nginx -c /usr/local/kong/nginx.conf -p /usr/local/kong/”

Yes, that worked, thanks.

I’ve seen those environment variables defined in quite a few places where Kong was not being started as a cmd. It would be good to update the docs to avoid misunderstandings.

Regards,
Luiz

1 Like

Thanks, we always appreciate community contribution, mind sending PRs?

I’m glad to help. As for the PR for the docs, I believe your team is in a better position to to that. I’ve seen it in a few places.

Regards,
Luiz