On Thu, Feb 18, 2016 at 10:57 AM, Willy Tarreau <[email protected]> wrote:
> Hi Aleks,
>
> On Wed, Feb 17, 2016 at 04:30:06PM +0100, Aleksandar Lazic wrote:
>> Hi.
>>
>> how difficult is it to be able to add "log stdout;" to haproxy?
>>
>> I ask because in some PaaS environment is it difficult to setup a
>> dedicated user yust for haproxy.
>>
>> It fits also a little bit better to http://12factor.net/logs
>
> It's been discussed a few times in the past. The response is "no".
> It's totally insane to emit logs to a blocking destination. Your
> whole haproxy process will run at the speed of the logs consumer
> and the log processing will incure its latency to the process.
>
> If one day we implement an synchronous stream logging task, this
> could change, but for now we send immediate logs as datagrams in
> order never to block.
>
> To get an idea about what it can look like with blocking logs,
> simply run "haproxy -d 2>&1 | more" and don't press any key.
> You'll quickly see that the system continues to accept new
> connections and that they will randomly freeze at various steps.
>
> Regards,
> Willy
>
>

My 2 cents: Some tools may be used for this purpose:

Configure HAProxy to send logs to port 2000, then use:

- socat:
socat -u UDP-RECV:2000 -
<133>Feb 18 11:27:02 haproxy[4134]: Proxy f started.
<133>Feb 18 11:27:02 haproxy[4134]: Proxy b started.
<133>Feb 18 11:27:02 haproxy[4134]: Proxy stats started.
<129>Feb 18 11:27:02 haproxy[4134]: Server b/s is DOWN, reason: Layer4
connection problem, info: "Connection refused", check duration: 0ms. 0
active and 0 backup servers left. 0 sessions active, 0 requeued, 0
remaining in queue.
<128>Feb 18 11:27:02 haproxy[4134]: backend b has no server available!

- netcat:
netcat -l -k -u 2000
<133>Feb 18 11:28:17 haproxy[4303]: Proxy f started.
<133>Feb 18 11:28:17 haproxy[4303]: Proxy b started.
<133>Feb 18 11:28:17 haproxy[4303]: Proxy stats started.
<129>Feb 18 11:28:17 haproxy[4303]: Server b/s is DOWN, reason: Layer4
connection problem, info: "Connection refused", check duration: 0ms. 0
active and 0 backup servers left. 0 sessions active, 0 requeued, 0
remaining in queue.
<128>Feb 18 11:28:17 haproxy[4303]: backend b has no server available!



Baptiste

Reply via email to