Skip to content

Date format bogus error #2793

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

Open
KQRCSC opened this issue Feb 21, 2025 · 6 comments
Open

Date format bogus error #2793

KQRCSC opened this issue Feb 21, 2025 · 6 comments

Comments

@KQRCSC
Copy link

KQRCSC commented Feb 21, 2025

Token '02' doesn't match specifier '%m'

As far as I know 02 is February and %m is defined "The month as a decimal number (range 01 to 12)"
So how is this an error?

@allinurl
Copy link
Owner

Could you please share the entire line from your log so I can take a closer look? Thanks

@KQRCSC
Copy link
Author

KQRCSC commented Feb 21, 2025

--log-format='%Y-%m-%d %H:%M:%S,%f %^ %^ [%^] %^ %h %^ %r %^ %s %^' --date-format='%Y-%m-%d' --time-format='%H:%M:%S,%f'

2025-02-20 13:50:27,007 INFO fi.csc.virta.julkaisut.filter.LogFilter [http-nio-8080-exec-9] Request from 162.162.162.162 GET /api/cerif?verb=ListRecords&resumptionToken=MTpAJrt5HJu9aplKTRujIld34aDFghJKa3s2JUoPPoU= - 200 OK

@allinurl
Copy link
Owner

This should do it:

goaccess log --log-format='%d %t,%^ %e %v [%^] %^ %^ %h %^ %r %^ %s %^' --date-format=%Y-%m-%d --time-format=%T --date-spec=min -H no -M no

@KQRCSC
Copy link
Author

KQRCSC commented Feb 24, 2025

Thanks! That did it, but I don't really understand how and why :)

@allinurl
Copy link
Owner

You were almost there with your format! However, in the log format, the date is represented by %d rather than the actual date specifiers used by strptime. The same applies to the time. Let me know if that helps clarify.

@KQRCSC
Copy link
Author

KQRCSC commented Feb 26, 2025

That part I understood, the "extras" in the end were mystifying --date-spec=min -H no -M no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants