owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.36k stars 180 forks source link

Content of pretty log format and unpretty log format isn't the same #10068

Open d7oc opened 4 days ago

d7oc commented 4 days ago

Describe the bug

By product definition the content of the log should be the same not matter if pretty log output is enabled or not. This isn't the case. Some field like the IP address are missing in pretty log output.

Steps to reproduce

  1. Enabled pretty log output
  2. Do some operation
  3. Look at the log output
  4. Disabled pretty log output
  5. Do some operation
  6. Compare the log output with the result before

Expected behavior

The log output should be the same, just the formatting should be different.

Actual behavior

The log output isn't the same. The IP address is missing

Pretty log:

proxy-6d4d85677f-59dwl proxy 2024-09-15T13:22:50Z ERR Could not get user by claim error="parsing time \"http://www.google.com/\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"http://www.google.com/\" as \"2006\"" authenticator=signed_url line=github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/signed_url_auth.go:243 path=/remote.php/dav/spaces/xxx/index.html service=proxy url=/remote.php/dav/spaces/1da06874-da62-43a9-9b21-6c68e3c36865%242a035869-7f49-4ef5-b20e-4ea72970eb99/index.html?OC-Credential=xxx%40acc.myaccessid.org&OC-Date=http%3A%2F%2Fwww.google.com%2F&OC-Expires=1200&OC-Verb=GET&OC-Algo=PBKDF2%2F10000-SHA512&OC-Signature=xxx

Standard log:

proxy-86d79db66-gs6zc proxy {"level":"error","service":"proxy","error":"failed to verify access token: token is expired by 12m36.978976343s","authenticator":"oidc","path":"/ocs/v2.php/apps/notifications/api/v1/notifications/sse","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0","client.address":"92.117.244.5","network.peer.address":"","network.peer.port":"","time":"2024-09-16T13:09:17Z","line":"github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/oidc_auth.go:194","message":"failed to authenticate the request"}

Setup

Kubernetes setup, but setup shouldn't matter.

micbar commented 4 days ago

hm, from a first glance, these are not identical error messages.

1 github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/signed_url_auth.go:243 2 github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/oidc_auth.go:194

micbar commented 4 days ago

NOTE, not all log entries have the same attributes.

d7oc commented 4 days ago

But they should all contain the client IP address, right? Otherwise we can't detect the source.

micbar commented 4 days ago

No, they should not.