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

Token '- [03/Apr/2024' doesn't match specifier '%d' #2656

Open
Xuezenghuigithub opened this issue Apr 3, 2024 · 1 comment
Open

Token '- [03/Apr/2024' doesn't match specifier '%d' #2656

Xuezenghuigithub opened this issue Apr 3, 2024 · 1 comment

Comments

@Xuezenghuigithub
Copy link

This is an example of my Nginx log:

10.232.9.57:10718, 10.232.25.9 = 10.232.25.9 - - [03/Apr/2024:00:00:11 +0800] "GET /api/sample HTTP/1.1" 200 63 "-" "membership/2.1.10 Alamofire/5.0.0-rc.2" "10.232.9.57:10718" 0.011"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJvbiIsInVzZXJJZCI6MTkxOTU1MSwiaWF0IjoxNzA4NDQzODY1fQ.-73XU5cdMUIvGlyzTz-nEwTDMCGYuJTnsWkyapGQdPg2hhOm6b8l3bsjYEhL9-6rkP1fW2p-teonHI6vs4ECnQ"

10.232.9.57:65052, 10.232.25.7 = 10.232.25.7 - - [03/Apr/2024:00:00:11 +0800] "GET /api/sample HTTP/1.1" 200 1014 "https://servicewechat.com/wxf3ae719fecac9fe9/66/page-frame.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.46(0x18002e2c) NetType/WIFI Language/zh_CN" "10.232.9.57:65052" 0.198"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJvbiIsInVzZXJJZCI6MjU5NzkyOCwiaWF0IjoxNzEyMDczNjA3fQ.YTPs1KdEVC95T3W_UWL7MUSbitHiqvDEv52Owy0vlaScm_bbhHIDRfs3KlI-t6t552CUrjkVnJRe8fxvn02mNA"

This is my Nginx log format:

log_format main '$proxy_add_x_forwarded_for = $remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for" $request_time'
    '"$http_authorization"';

I got the format from nginx2goaccess and changed to this:

goaccess access.log --log-format='%^ = %^ - %^ [%d:%t %^] "%r"  %s %b "%R"  "%u" "%^" %T "%^"' --datetime-format='%d/%b/%Y:%H:%M:%S %z' --time-format='%H:%M:%S' --date-format='%d/%b/%Y'

But still got this error:

==10570== GoAccess - version 1.9.1 - Feb  6 2024 01:27:39
==10570== Config file: /usr/local/Cellar/goaccess/1.9.1/etc/goaccess/goaccess.conf
==10570== https://goaccess.io - <hello@goaccess.io>
==10570== Released under the MIT License.
==10570==
==10570== FILE: error.log
==10570== 已解析 10 行 出现以下错误:
==10570==
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570== Token '- [03/Apr/2024' doesn't match specifier '%d'
==10570==
==10570== 格式错误 - 请检查你的日志/日期/时间格式
@allinurl
Copy link
Owner

allinurl commented Apr 6, 2024

Apologies for the delay. This should address the issue:

# goaccess access.log --log-format='%^= %h %^[%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T"%^' --date-format=%d/%b/%Y --time-format=%T

Or if your log lines are using English date formats but your server is not in an English-language locale, please ensure you use LC_TIME:

# LC_TIME="en_US.UTF-8" goaccess access.log --log-format='%^= %h %^[%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T"%^' --date-format=%d/%b/%Y --time-format=%T

2024-04-05-192759_501x465_scrot

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