kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.47k stars 8.25k forks source link

Use json log format for controller Go-app #4818

Closed martonsz closed 4 years ago

martonsz commented 4 years ago

Feature request

I would like to change the log format for the Go-application to json format.

I have already changed the log format for nginx to json (log-format-upstream and log-format-stream). But the Go-apps are using its own logging(klog?).

I am talking about these logs:

I1209 10:43:56.413306       7 nginx.go:406] Stopping NGINX process
2019/12/09 10:43:56 [notice] 117#117: signal process started
I1209 10:43:59.505768       7 nginx.go:419] NGINX process has stopped
I1209 10:43:59.505885       7 main.go:161] Handled quit, awaiting Pod deletion
I1209 10:44:09.515951       7 main.go:164] Exiting with 0
-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       0.26.1
  Build:         git-2de5a893a
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: openresty/1.15.8.2

-------------------------------------------------------------------------------

I1209 10:44:17.137660       7 flags.go:198] Watching for Ingress class: nginx
W1209 10:44:17.137790       7 flags.go:243] SSL certificate chain completion is disabled (--enable-ssl-chain-completion=false)

Notice that the second row has another formating. Where does that come from?

NGINX Ingress controller version: 0.26.1 Kubernetes version : 1.16.3

fejta-bot commented 4 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot commented 4 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

jasonchester commented 4 years ago

+1 for having the controller logs formatted in json for easier ingestion into elastic or other log search platforms

/remove-lifecycle rotten

fejta-bot commented 4 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot commented 4 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot commented 4 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

k8s-ci-robot commented 4 years ago

@fejta-bot: Closing this issue.

In response to [this](https://github.com/kubernetes/ingress-nginx/issues/4818#issuecomment-687837022): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >Send feedback to sig-testing, kubernetes/test-infra and/or [fejta](https://github.com/fejta). >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
iusergii commented 3 years ago

Also would love to have this. Puzzled about how to parse the log in a mixed format.

/remove-lifecycle rotten