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

Problem with spaces in custom log format and Haproxy #967

Closed
olimpo88 opened this issue Dec 19, 2017 · 3 comments
Closed

Problem with spaces in custom log format and Haproxy #967

olimpo88 opened this issue Dec 19, 2017 · 3 comments

Comments

@olimpo88
Copy link

Hi, I have the following issue

in my Haproxy I declare the following:

   capture request header Host len 128
   capture request header User-Agent len 128
   capture request header Referer len 128

the log is the following

Dec 19 13:40:30 localhost haproxy[5417]: 172.16.200.1:47878 [19/Dec/2017:13:40:30.102] https_server~ backend_24x7/srv-ha-24x7 395/0/0/2/397 200 1654 - - ---- 6/6/0/0/0 0/0 {domain.com|Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36|https://domain.com/icinga/} "GET /icinga/images/favicon.ico HTTP/1.1"

In goaccess the proproblem is that I can not separate the three values that are between the brace

{host|User-Agent|Referer}

The user-agent contains spaces, that's why I can not do it this way:

{^%|%u|%R}

Is it possible to change the delimiter? For example, by the pipe

Thanks.
Regards.

@allinurl
Copy link
Owner

Not entirely sure what you mean with changing the delimiter, however, I think the following should do it (at least for the line posted above):

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

Let me know if that solves the issue.

@allinurl allinurl changed the title problem with spaces and Haproxy Problem with spaces in custom log format and Haproxy Dec 19, 2017
@olimpo88
Copy link
Author

olimpo88 commented Dec 19, 2017

thank you very much, it works perfect.

Edit:
I'm finally using this filter

--log-format='%^:%^:%^: %h:%^[%d:%t.%^] %^ %^/%^ %^/%^/%^/%^/%L %s %b %^{%v|%u|%R} "%r"' --date-format=%d/%b/%Y --time-format=%T

@allinurl
Copy link
Owner

Great to hear that :)

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