That would definitely be more useful, although it would also require
rewriting a lot of the code around how log variables are interpolated.
Right now, it looks like interpolation is pretty tightly tied to the actual
act of logging (the build_logline function is pretty attached to the idea
of having an active session available, and I think it'd be a lot of work to
detangle it into a "build_logline_from_backend" that just took a backend or
somesuch).

On Thu, Oct 22, 2015 at 2:37 AM, Baptiste <[email protected]> wrote:

> On Thu, Oct 22, 2015 at 3:59 AM, James Brown <[email protected]> wrote:
> > Hello haproxy@:
> >
> > My name is James Brown; I wrote a small piece of software called hacheck
> > (https://github.com/Roguelazer/hacheck) which is designed to be a
> healthcheck
> > proxy for decentralized load balancer control (remove a node from a load
> > balancer without knowing where the load balancers are; helpful once you
> > start to have a truly, stupidly large number of load balancers).
> >
> > I am interested in using agent-checks instead of co-opting the existing
> > httpchk mechanism; unfortunately, it looks like there's no convenient
> way to
> > multiplex multiple services onto a single agent-port and reasonably
> > disambiguate them. For example, it'd be great if I could have a server
> which
> > runs one agent-check responder and can `MAINT` any of a dozen (or a
> hundred)
> > different services running on this box.
> >
> > I've attached a small patch which adds a new server parameter
> (agent-send)
> > which is a static string which will be sent to the agent on every server.
> > This allows me to generate configs that look like
> >
> >     backend foo
> >         server web1 10.1.2.1:8001 agent-check agent-port 3334
> agent-send "foo/web1\n"
> >         server web2 10.1.2.2:8001 agent-check agent-port 3334
> agent-send "foo/web2\n"
> >
> >     backend bar
> >         server web1 10.1.2.1:8002 agent-check agent-port 3334
> agent-send "bar/web1\n"
> >         server web2 10.1.2.2:8002 agent-check agent-port 3334
> agent-send "bar/web2\n"
> >
> > And have a single service (running on port 3334) which can easily MAINT
> or
> > UP either "foo" or "bar" depending on the value that it receives.
> >
> > The patch seems to work in my limited testing (that is to say, HAProxy
> sends
> > the string and doesn't segfault or leak infinite amounts of RAM).
> >
> > Does this sound useful to anyone else? Is it worth upstreaming the
> patch? I
> > welcome your thoughts.
> > --
> > James Brown
> > Engineer
> > EasyPost
>
> Hi James,
>
> This is interesting.
> That said, I'm suggesting an improvement: use the log format varialble.
>
> So your configuration would become:
>
> backend foo
>   default-server agent-send "%b/%s\n"
>   server web1 10.1.2.1:8001 agent-check agent-port 3334
>   server web2 10.1.2.2:8001 agent-check agent-port 3334
>
> Baptiste
>



-- 
James Brown
Engineer

Reply via email to