Frontend IP and ports not logged in TCP mode, custom log format (%fi %fp)


Hi there!
I am trying to have HAProxy log the frontend’s IP and port for the client side. I am running haproxy 1.5.14 on RHEL 7.2

These are the relevant configuration parts:

    mode                    tcp
    log                     global
    log-format %H\ [%t]\ %ci:%cp->%fi:%fp(%ft)\ %bi:%bp->%si:%sp(%s)\ %Tw/%Tc/%Tt\ %U/%B\ %ts\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq

listen Test
    bind  # external interface
    bind     # internal interface
    server test-src2 source

Now: Everything works like a charm, but the log looks like this:
Jun 20 14:50:16 localhost haproxy[16961]: testbox [20/Jun/2017:14:50:11.149]>:0(Test)> 1/0/5653 18/48 -- 0/0/0/0/0 0/0

As you see, is the log part “%fi:%fp” expanded into ":0 . I would expect the frontend destination IP and port. What am I missing?


Thanks for the report, this a bug (and a very old one too, yet you are the first one to notice).

I reported the issue along with some details on the mailing list:

All releases supporting “log-format” are affected (1.5+).


Fix is committed:;a=commit;h=d02286d6c866e5c0a7eb6fbb127fa57f3becaf16

There is workaround: replace %fi:%fp with %[dst]:%[dst_port]