ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Possibility to configure klog logs to json

Open sebastiangaiser opened this issue 1 year ago • 6 comments

Hey, when setting the following values in the Helm chart:

controller:
  config:
    log-format-escape-json: "true"
    log-format-upstream: '...'

it is possible to configure the access log in the format I want to have. But I didn't found an option to configure all logs (the klog one's) of the container in json due to https://github.com/kubernetes/ingress-nginx/blob/256374079f29993e554b934ffec576b7b6fd54ac/cmd/nginx/main.go#L54

I would be great to make this configurable.

sebastiangaiser avatar Jan 20 '24 11:01 sebastiangaiser

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 20 '24 11:01 k8s-ci-robot

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

github-actions[bot] avatar Feb 20 '24 01:02 github-actions[bot]

I understand one way to achieve this is to switch to using component-base/logs. I understand that this is more tightly integrated to the kubernetes lifecycle (with featureGates, alpha/beta/deprecation status), so is this something the maintainers of ingress-nginx would welcome ?

If so, I'll try to work on a PR, time permitting.

VannTen avatar May 24 '24 11:05 VannTen

@VannTen I'm not a maintainer but if you want you can start anyways, right ;)

sebastiangaiser avatar Jun 17 '24 12:06 sebastiangaiser

I am not a developer so just curious if the suggestion here is different from this https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#log-format-upstream

longwuyuan avatar Jun 17 '24 13:06 longwuyuan

log-format-upstream is about nginx access logs, this is about the logs related to the ingress-controller (aka, watching the Ingress object, etc)

VannTen avatar Jun 17 '24 14:06 VannTen