Log more information, package destination


#1

Hey guys,
I’m working on a project for my Bachelor thesis and I am currently trying to understand how HAProxy works. For my project I’d like to log more information from HAProxy. My defaults are

mode http
timeout client 120s
timeout server 120s
timeout connect 30s
option http-buffer-request
option httplog
option tcplog
option log-health-checks
log global

I would like to log where every single http-Package is sent to according to my ACL. My ACL, according to my .cnf SHOULD send a package according to information in the http-body.

acl name req.body -m reg < WhatImLookingFor >
use_backend bert if name

Am I on the right track? Or do I need to change something in the source code?

Sorry, I’m a newbie to communication protocols and C.

Thanks in advance,
DL


#2

Use one of those 2. Remove tcplog, if you already using httplog.

I assume “package” means transaction or request. You can already see that with regular logging.

Read the logging section in the manual, more specifically the section regarding httplog:
http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8
http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.3


#3

Hey, thank your for your input.

But why? Do they not stack? Or does tcp log override my httplog setting?

DL


#4

No, they don’t stack, the are different logging formats, you either use one or the other.

I don’t know for certain, but I guess tcplog would overwrite httplog in this case, so you would lack all the details httplog provides.


#5

Hey Dalu!!!
I think what you are doing is for project thesis!!!
This is the way what you have mentioned in configuration file is syslog. that log would not be sufficient for you mate…
if you really interested for so, you may enable the debug log in Makefile. and run with ./haproxy -f /etc/haproxy/haproxy.cfg -d. Alternatively, is the trace log. That are useful in your case to understand. Another option is to use sysdig. you need to install sysdig on Linux machine. and before starting haproxy open a tab and use the command : # sysdig proc.name=haproxy; that would generate the log for haproxy. which shows the http socket connection between backend server and haproxy server [ for health check, frontend, backend starting, curl related while load balancing is being performed].

Let me know if you face any issue while doing above.