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

Can't parse if agent is empty #6

Closed
yorik opened this issue Jul 20, 2014 · 4 comments
Closed

Can't parse if agent is empty #6

yorik opened this issue Jul 20, 2014 · 4 comments
Labels

Comments

@yorik
Copy link

yorik commented Jul 20, 2014

If there is a line in nginx log with empty user agent it fails with a message like this:

panic: Access log line 'xx.xx.xx.xx - [21/Apr/2014:06:25:10 +0000] "GET / HTTP/1.0" 200 15389 "-" ""' does not match given format '^(?P<remote_addr>[^ ]+) - [(?P<time_local>[^]]+)] "(?P[^ ]+) (?P[^ ]+) (?P[^"]+)" (?P[^ ]+) (?P[^ ]+) "(?P[^"]+)" "(?P[^"]+)"$'

@satyrius satyrius added the bug label Jul 20, 2014
@satyrius
Copy link
Owner

What format do you use for parsing?

@yorik
Copy link
Author

yorik commented Jul 20, 2014

The regular one:
http {
log_format main '$remote_addr $user [$time_local] "$method $url $proto" $status $size "$referer" "$agent"';
}

@satyrius
Copy link
Owner

Ok, I see the problem... the format to regular expression translation is not perfect. I'm going to fix it. Thanks for report!

satyrius added a commit that referenced this issue Jul 20, 2014
@yorik
Copy link
Author

yorik commented Jul 21, 2014

Thank you! It works.

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

No branches or pull requests

2 participants