On Fri, Feb 13, 2015 at 06:38:53PM +0000, Chris wrote:
> Is it possible to use a map file to specify a rate for a specific source
> IP/subnet?  Something like this?
> 
>     acl conn_rate_abuse sc2_conn_rate gt
> %[src,map_ip_int(/etc/haproxy/src_to_rate.map)]

No it's not possible, patterns are constants.

> I can see there might be a problem because a map isn't guaranteed to have a
> match?  It might be a nice feature to have a version of the map functions
> that take a default as a parameter.  Something like:
>     
>     map_ip_int(my_map_file, 10)    
> 
> where 10 is the default returned if there is no match.

For now we cannot operate on multiple variables, only one at a time.
It's a limitation caused by the config parser for one part, and by
the sample expression evaluator for another part.

> p.s.  What do you call the %[] thing?  I may be blind, but have yet to see
> it named in the documentation.

We call this a format string or log-format string, because initially that
was made only for custom log formats, and as you can see, anytime you can
build a composite string, it ends up propagating everywhere...

Willy


Reply via email to