Goaccess: Problem with spaces in custom log format and Haproxy

Created on 19 Dec 2017  路  3Comments  路  Source: allinurl/goaccess

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.

lodattime format question

All 3 comments

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.

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

Great to hear that :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eroldru picture eroldru  路  3Comments

securixhk picture securixhk  路  3Comments

canepa picture canepa  路  3Comments

Tassleh0ff picture Tassleh0ff  路  4Comments

SergioDG-YCC picture SergioDG-YCC  路  3Comments