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 '' doesn't match specifier '%h' #1635

Closed
almirus opened this issue Dec 25, 2019 · 7 comments
Closed

Token '' doesn't match specifier '%h' #1635

almirus opened this issue Dec 25, 2019 · 7 comments

Comments

@almirus
Copy link

@almirus almirus commented Dec 25, 2019

if LOG have leading space, get error Token '' doesn't match specifier '%h'
[SPACE]10.88.241.31 - - [24/Nov/2019:03:34:04 +0300] "GET /" 200 21139 "-" "-"

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Dec 26, 2019

You will need to use a custom log format. e.g.,

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

This comment has been minimized.

Copy link

@librenauta librenauta commented Jan 6, 2020

hi! same problem, sorry im very new to this , my log is

- [06/Jan/2020:04:53:22 +0100]
 "GET / HTTP/1.1" 200 3658 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:22 +0100]
 "GET /css/base.css HTTP/1.1" 200 10887 "https://mesh.copiona.com/" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:22 +0100]
 "GET /js/anime.min.js HTTP/1.1" 200 14420 "https://mesh.copiona.com/" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:22 +0100]
 "GET /js/demo.js HTTP/1.1" 200 4521 "https://mesh.copiona.com/" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:23 +0100]
 "GET /favicon.ico HTTP/1.1" 200 13294 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:23 +0100]
 "GET /img/hydra.jpg HTTP/1.1" 200 771227 "https://mesh.copiona.com/css/base.css" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0" "-"
- [06/Jan/2020:04:53:58 +0100]
 "HEAD / HTTP/1.1" 400 0 "-" "Monit/5.20.0" "-"

when type :$ sudo goaccess -f /var/log/nginx/access.log

drop it :

Parsed 1 linesproducing the following errors:

Token '-' doesn't match specifier '%h'

Format Errors - Verify your log/date/time format
any help is welcome <3

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Jan 8, 2020

@librenauta GoAccess requires the following fields:

a valid IPv4/6 %h
a valid date %d
the request %r

@librenauta

This comment has been minimized.

Copy link

@librenauta librenauta commented Jan 17, 2020

thnks, i edit my conf nginx with:
http {
log_format specialLog '$remote_addr forwarded for $http_x_real_ip - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/blog/access.log specialLog;
}

and run with:
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

Originally posted by @allinurl in #1546 (comment)

thnks 4 help <3

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Jan 17, 2020

@librenauta Please try:

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

This comment has been minimized.

Copy link

@librenauta librenauta commented Jan 17, 2020

it's works, thank u for that support

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Jan 17, 2020

Awesome. Closing this. Feel free to reopen it as needed.

@allinurl allinurl closed this Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.