Re: Log 400 bad request

2012-02-13 Thread Sander Klein

Hi Willy,

On 13.02.2012 08:07, Willy Tarreau wrote:

You won't have it in the log because the request failed to completely
parse. Maybe we could improve a bit the error path to be able to 
report

the request URI when only headers fail, that would help.


In my case that won't help. I need to find the bad URI since there are 
not encoded UTF-8 characters in them.



I know I can show them with 'echo show errors | socat
unix-connect:/var/run/haproxy.stat stdio' but since we don't know 
when

and where the problems happen we would like to log it to a file.


Some people are doing this using scripts which regularly poll. That
should not be an issue since you should not have that many errors. 
There
is an event ID in this output so that your script knows if the error 
is

an old one or a new one. For instance here :


Well, I'll write a script to poll every once in a while. Then I can 
practice my perl skills again ;-)


Regards,

Sander



Re: Log 400 bad request

2012-02-12 Thread Willy Tarreau
Hi Sander,

On Fri, Feb 10, 2012 at 04:28:39PM +0100, Sander Klein wrote:
 Hi All,
 
 I'm having a small problem with non RFC2616 requests. I would like to 
 log them, but haproxy only logs:
 
 cluster1-in cluster1-in/NOSRV -1/-1/-1/-1/0 400 1951 - - PR-- 
 235/235/0/0/0 0/0 {|||} {} BADREQ
 
 Is there a way to log them with the full host header and URL?

You won't have it in the log because the request failed to completely
parse. Maybe we could improve a bit the error path to be able to report
the request URI when only headers fail, that would help.

 I know I can show them with 'echo show errors | socat 
 unix-connect:/var/run/haproxy.stat stdio' but since we don't know when 
 and where the problems happen we would like to log it to a file.

Some people are doing this using scripts which regularly poll. That
should not be an issue since you should not have that many errors. There
is an event ID in this output so that your script knows if the error is
an old one or a new one. For instance here :

Total events captured on [13/Feb/2012:08:05:27.393] : 15
 
[02/Feb/2012:00:47:19.447] frontend http-in (#1): invalid request
  src 88.191.95.247, session #189428, backend NONE (#-1), server NONE (#-1)
  HTTP internal state 26, buffer flags 0x00809002, event #12
  request length 222 bytes, error at position 55:
 
  0  GET //wp/wp-content/themes/automotive-blog-theme/Quick Cash Auto/timth
  00070+ umb.php HTTP/1.1\r\n
  00088  Accept: */*\r\n
  00101  Accept-Language: en-us\r\n
  00125  Accept-Encoding: gzip, deflate\r\n
  00157  User-Agent: Mozilla/5.0\r\n
  00182  Host: demo.1wt.eu\r\n
  00201  Connection: Close\r\n
  00220  \r\n

You see, it's event #12 above. And your script has to first check the first
line to see if the event count is higher than upon last check.

Regards,
Willy




Log 400 bad request

2012-02-10 Thread Sander Klein

Hi All,

I'm having a small problem with non RFC2616 requests. I would like to 
log them, but haproxy only logs:


cluster1-in cluster1-in/NOSRV -1/-1/-1/-1/0 400 1951 - - PR-- 
235/235/0/0/0 0/0 {|||} {} BADREQ


Is there a way to log them with the full host header and URL?

I know I can show them with 'echo show errors | socat 
unix-connect:/var/run/haproxy.stat stdio' but since we don't know when 
and where the problems happen we would like to log it to a file.


Greets,

Sander