Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Access Logs should allow ISO 8601 date format #40614

Open
trixpan opened this issue May 14, 2024 · 5 comments
Open

HTTP Access Logs should allow ISO 8601 date format #40614

trixpan opened this issue May 14, 2024 · 5 comments
Labels
area/logging kind/enhancement New feature or request

Comments

@trixpan
Copy link

trixpan commented May 14, 2024

Description

It is 2024. We are already asking how can we manage timestamps from Mars, yet in Quarkus we are stuck with a locale bound timestamp... :-)

09/May/2024:22:41:30 +000

Date and time, in Common Log Format format %t %{DATE_TIME}

There seems to be an undocumented %{time, option but who would want to use an undocumented option for something so critical?

Implementation ideas

No response

@quarkus-bot
Copy link

quarkus-bot bot commented May 14, 2024

/cc @MichalMaler (documentation), @ebullient (documentation), @inoxx03 (documentation), @michelle-purcell (documentation), @rolfedh (documentation), @sheilamjones (documentation), @sunayna15 (documentation)

@maxandersen
Copy link
Contributor

@trixpan i'm having a challenge parsing your request/enhancement.

Are you saying that %{time} works for you and it does what you need and you just wish it was officially documented?
or saying that nothing seemed to work, please add a way to add iso formatting?

I'm actually personally surprised access log is using locale driven format by default :)

@gsmet
Copy link
Member

gsmet commented May 16, 2024

For the record, the date format is actually correct and follows the Common Log Format used for access logging since forever (that might explain the format not exactly in line with our modern habits...)

Quoting Wikipedia:

[10/Oct/2000:13:55:36 -0700] is the date, time, and time zone that the request was received, by default in strftime format %d/%b/%Y:%H:%M:%S %z.

From https://en.wikipedia.org/wiki/Common_Log_Format .

Now I don't know if there's a better format nowadays, that is widely used.

As for %{time,, it looks supported in DateTimeAttribute and allows to provide a custom format. We should probably add it to the doc.

@trixpan care to provide a patch for https://github.com/quarkusio/quarkus/blob/main/docs/src/main/asciidoc/http-reference.adoc?plain=1#L376 ?

@trixpan
Copy link
Author

trixpan commented May 16, 2024

@gsmet "correct" is subjective, after all, quarkus http logs may be json logs where the CLF doesn't directly apply, so restricting the logger abilities may be undesirable.

I get a PR on your way later today.

Cheers

@gsmet
Copy link
Member

gsmet commented May 16, 2024

So yes, but access logs are inherited from the good old Apache days. and CLF was well... common? (I was there!)

Now, yes, we should document the other option and also it would be nice to provide an example for ISO 8601 that people can just copy paste.

We could even imagine a shortcut but it seems risky given the number of various options supported.

Let's at least start with the doc, that's definitely something we need to document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging kind/enhancement New feature or request
Development

No branches or pull requests

5 participants