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

Format to use for goaccess log #1546

Open
raylwalters opened this issue Sep 11, 2019 · 5 comments
Open

Format to use for goaccess log #1546

raylwalters opened this issue Sep 11, 2019 · 5 comments

Comments

@raylwalters
Copy link

raylwalters commented Sep 11, 2019

I am unsure what format to use for my nginx-access.log, here are a few lines:

35.226.232.192 - - [09/Sep/2019:04:12:52 +0000]  "GET /events/all-events/summer-2019-summer-i-examinations%252523main-content%3Fperks%255B0%255D%3D8113?org_unit%5B0%5D=6580&org_unit%5B1%5D=6556&org_unit%5B2%5D=6430&org_unit%5B3%5D=6571&org_unit%5B4%5D=6568&org_unit%5B5%5D=6697 HTTP/1.1" 200 17219 "https://www.google.com" "Mozilla/5.0 (Linux; Android 7.0; FRD-AL00 Build/HUAWEIFRD-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043602 Safari/537.36 MicroMessenger/6.5.16.1120 NetType/WIFI Language/zh_CN" 1.295 "111.178.128.150, 111.178.128.150"
35.193.221.59 - - [09/Sep/2019:04:12:54 +0000]  "GET /events/all-events/summer-2019-summer-i-examinations%252523main-content%3Forg_unit%255B0%255D%3D6682?org_unit%5B0%5D=6556&org_unit%5B1%5D=6598&org_unit%5B2%5D=6553&org_unit%5B3%5D=6694&audience%5B0%5D=8012&audience%5B1%5D=2 HTTP/1.1" 200 14718 "https://www.google.com" "Mozilla/5.0 (Linux; Android 7.0; FRD-AL00 Build/HUAWEIFRD-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043602 Safari/537.36 MicroMessenger/6.5.16.1120 NetType/WIFI Language/zh_CN" 0.961 "117.78.58.22, 117.78.58.22"
35.226.232.192 - - [09/Sep/2019:04:12:57 +0000]  "GET /events/all-events?audience%5B0%5D=8131&audience%5B1%5D=8015&audience%5B2%5D=6&org_unit%5B0%5D=6697 HTTP/1.1" 200 13720 "-" "Linguee Bot (http://www.linguee.com/bot; bot@linguee.com)" 0.683 "188.138.41.169, 188.138.41.169"
35.193.221.59 - - [09/Sep/2019:04:13:16 +0000]  "GET /node/add HTTP/1.1" 403 9446 "https://umdearborn.edu/?q=node/add" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36 OPR/53.0.2907.68" 0.266 "1.179.198.226, 1.179.198.226"
@allinurl
Copy link
Owner

Please try this (assuming the client IP is on the first field)

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

@raylwalters
Copy link
Author

@allinurl thank you for replying. After running
goaccess nginx-access.log-20190910 --log-format='%h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T %^' --date-format=%d/%b/%Y --time-format=%T

I get the following error:

Parsed 1 linesproducing the following errors:

Token 'ET' doesn't match specifier '%s'

Format Errors - Verify your log/date/time format

@allinurl
Copy link
Owner

My bad, I didn't see your reply. Please try:

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

@abdul-alim
Copy link

abdul-alim commented Feb 17, 2022

Hi Team,
Having the same issue.

Log Sample:

[17/Feb/2022:10:34:56 +0000] - 200 200 - GET https www.dealzone.app "/" [Client 49.204.136.60] [Length 93] [Gzip -] [Sent-to api] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4692.99 Safari/537.36" "-"
[17/Feb/2022:10:34:57 +0000] - 200 200 - GET https www.dealzone.app "/" [Client 49.204.136.60] [Length 93] [Gzip -] [Sent-to api] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4692.99 Safari/537.36" "-"

Error:

Token '[17/Feb/2022:10:34:33' doesn't match specifier '%h'

@allinurl
Copy link
Owner

@abdul-alim Sorry for the delay, this should do it:

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

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

3 participants