Re: How does http_find_header() work?

2011-04-01 Thread Willy Tarreau
On Fri, Apr 01, 2011 at 09:05:59AM -0400, Roy Smith wrote: > > On Thu, Mar 31, 2011 at 08:10:04AM -0400, Roy Smith wrote: > >> I didn't really write a specification, but I think a critical part of the > >> spec > >> would be that the only guarantee about the id string is that it's unique > > > >

Re: How does http_find_header() work?

2011-04-01 Thread Roy Smith
On Apr 1, 2011, at 2:11 AM, Willy Tarreau wrote: > On Thu, Mar 31, 2011 at 08:10:04AM -0400, Roy Smith wrote: >> I didn't really write a specification, but I think a critical part of the >> spec >> would be that the only guarantee about the id string is that it's unique > > It's unique within a

Re: How does http_find_header() work?

2011-03-31 Thread Willy Tarreau
On Thu, Mar 31, 2011 at 08:10:04AM -0400, Roy Smith wrote: > I didn't really write a specification, but I think a critical part of the spec > would be that the only guarantee about the id string is that it's unique It's unique within a delimited perimeter. That's important. In some contexts, it wi

Re: How does http_find_header() work?

2011-03-31 Thread Willy Tarreau
On Thu, Mar 31, 2011 at 07:58:53AM -0400, Roy Smith wrote: > Looking at the docs, I see some lines that use "option" and some that don't. > Is there a general rule as to when it should use "option"? Could you give me > a use case where you would want to apply this conditionally? Normally "opti

Re: How does http_find_header() work?

2011-03-31 Thread Roy Smith
My intent was just to have a unique string that could be searched for in the logs. Building it by smashing together the hostid, pid, timestamp, etc, was just a fast hack to get something unique. I made one attempt to compact the string by running it through md5, but then I realized that the mo

Re: How does http_find_header() work?

2011-03-31 Thread Roy Smith
Looking at the docs, I see some lines that use "option" and some that don't. Is there a general rule as to when it should use "option"? Could you give me a use case where you would want to apply this conditionally? As far as stripping headers, one of the problems is that the unique id inserti

Re: How does http_find_header() work?

2011-03-31 Thread Bart van der Schans
Hi, Thx Roxy, this would be very useful to have. I'm just wondering about the id format. If all the "fields" correspond to something meaningful, like host_id, pid, timestamp, etcetera, would it make sense to have them in a more human readable format? Regards, Bart On Thu, Mar 31, 2011 at 4:30 AM

Re: How does http_find_header() work?

2011-03-31 Thread Bryan Talbot
This would be useful, but having a format similar to what's currently used for forwardfor would be nice: option uniqueid [{if | unless} ] [ header ] I would also like to be sure that any incoming values for the header could be stripped (using reqidel) and still have the new one added properly.

Re: How does http_find_header() work?

2011-03-30 Thread Roy Smith
Willy, This turned out to be surprisingly straight-forward. Patch attached (against the 1.4.11 sources). To enable generation of the X-Unique-Id headers, you add "unique-id" to a listen stanza in the config file. This doesn't make any sense unless you're in http mode (although my code doesn'

Re: How does http_find_header() work?

2011-03-28 Thread Willy Tarreau
On Mon, Mar 28, 2011 at 01:50:58PM -0400, Roy Smith wrote: > OK, this looks like it works. I still need to do something smarter > about generating the unique ids (some combination of hostid, pid, and > time, and counter should do it), and adding a way to control this from > the config file. Befo

Re: How does http_find_header() work?

2011-03-28 Thread Roy Smith
On Mon, 2011-03-28 at 07:22 +0200, Willy Tarreau wrote: > On Sun, Mar 27, 2011 at 09:28:15PM -0400, Roy Smith wrote: > > Thanks! Looks like "capture request header" does exactly what I want. > > > > Well, mostly. This gets me logging if the header exists. Now I need to > > figure out how to i

Re: How does http_find_header() work?

2011-03-27 Thread Willy Tarreau
On Sun, Mar 27, 2011 at 09:28:15PM -0400, Roy Smith wrote: > Thanks! Looks like "capture request header" does exactly what I want. > > Well, mostly. This gets me logging if the header exists. Now I need to > figure out how to insert the header if it doesn't (taking us back to the > conversati

Re: How does http_find_header() work?

2011-03-27 Thread Roy Smith
Thanks! Looks like "capture request header" does exactly what I want. Well, mostly. This gets me logging if the header exists. Now I need to figure out how to insert the header if it doesn't (taking us back to the conversation we had in January). On Mar 27, 2011, at 2:22 PM, Willy Tarreau

Re: How does http_find_header() work?

2011-03-27 Thread Willy Tarreau
Hi Roy, On Sun, Mar 27, 2011 at 01:31:25PM -0400, Roy Smith wrote: > I'm trying to modify haproxy-1.4.11 (on Ubuntu) to do some additional > logging. I've added to http_sess_log(), some experimental code: > > --- a/src/proto_http.cSat Mar 26 12:38:10 2011 -0400 > +++ b/src/proto_http.c

How does http_find_header() work?

2011-03-27 Thread Roy Smith
I'm trying to modify haproxy-1.4.11 (on Ubuntu) to do some additional logging. I've added to http_sess_log(), some experimental code: --- a/src/proto_http.c Sat Mar 26 12:38:10 2011 -0400 +++ b/src/proto_http.c Sat Mar 26 19:18:30 2011 -0400 @@ -1081,6 +1081,7 @@ static char tmpline[MA