ocis icon indicating copy to clipboard operation
ocis copied to clipboard

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

Open d7oc opened this issue 1 year ago • 4 comments

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.

d7oc avatar Sep 16 '24 13:09 d7oc

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 avatar Sep 16 '24 14:09 micbar

NOTE, not all log entries have the same attributes.

micbar avatar Sep 16 '24 14:09 micbar

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

d7oc avatar Sep 16 '24 16:09 d7oc

No, they should not.

micbar avatar Sep 16 '24 16:09 micbar

Not sure if that matches with Product definition, but this is the Dev Definition of the two logging options:

  • Pretty Logging offers human readable logging. To achieve that it doesn't log most of the attributes. (imo it still logs too many.) It aims to log only the most viable information.
  • Standard Logging offers logging in json format. This can be consumed by a machine or a human and logs all available attributes.

kobergj avatar Oct 02 '24 13:10 kobergj