Hello,

It seems that the log-format defined in the “defaults” section is ignored.

==================================================
global
       log /dev/log    local0
       chroot /var/lib/haproxy
       stats socket /run/haproxy/admin.sock mode 660 level admin
       stats timeout 30s
       user haproxy
       group haproxy
       daemon

defaults
       log     global
       log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ 
h=%Th/i=%Ti/R=%TR/w=%Tw/c=%Tc/r=%Tr/d=%Td/a=%Ta/t=%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ 
%ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ %{+Q}r
       mode    http
       option  httplog
       option  dontlognull
       timeout connect 5000
       timeout client  50000
       timeout server  50000

frontend ft
       bind *:80
       default_backend bk
backend bk
       server web1 127.0.0.1:81
==================================================
This config does not use my log-format for the "listen" section
=> Jan 18 14:25:56 nb-ha2 haproxy[31956]: XXXXXXXX:61226 
[18/Jan/2017:14:25:53.484] ft ft/web1 0/0/-1/-1/3003 503 212 - - SC-- 0/0/0/0/3 
0/0 "GET / HTTP/1.1"


==================================================
global
       log /dev/log    local0
       chroot /var/lib/haproxy
       stats socket /run/haproxy/admin.sock mode 660 level admin
       stats timeout 30s
       user haproxy
       group haproxy
       daemon

defaults
       log     global
       mode    http
       option  httplog
       option  dontlognull
       timeout connect 5000
       timeout client  50000
       timeout server  50000

frontend ft
       bind *:80
       default_backend bk
       log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ 
h=%Th/i=%Ti/R=%TR/w=%Tw/c=%Tc/r=%Tr/d=%Td/a=%Ta/t=%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ 
%ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ %{+Q}r
backend bk
       server web1 127.0.0.1:81
==================================================
But of course, this one works.
Jan 18 14:26:16 nb-ha2 haproxy[31984]: XXXXXXX:61248 [18/Jan/2017:14:26:13.449] 
ft ft/web1 h=0/i=1/R=0/w=0/c=-1/r=-1/d=-1/a=3003/t=3004 503 212 - - SC-- 
0/0/0/0/3 0/0 "GET / HTTP/1.1"

Is there a mistake in my config ? or it is a bug with log-format in defaults ?
I get the same problem if I use a “listen” section instead of a 
“frontend/backend” sections.

I tried the debian jessie-backports version and the latest git version : 
==================================================
ha1:~# haproxy -vvv
HA-Proxy version 1.7.1-1~bpo8+1 2016/12/17
Copyright 2000-2016 Willy Tarreau <[email protected]>

Build options :
 TARGET  = linux2628
 CPU     = generic
 CC      = gcc
 CFLAGS  = -g -O2 -fPIE -fstack-protector-strong -Wformat 
-Werror=format-security -D_FORTIFY_SOURCE=2
 OPTIONS = USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=1 USE_PCRE=1 USE_NS=1

Default settings :
 maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.8
Running on zlib version : 1.2.8
Compression algorithms supported : identity("identity"), deflate("deflate"), 
raw-deflate("deflate"), gzip("gzip")
Built with OpenSSL version : OpenSSL 1.0.2j  26 Sep 2016
Running on OpenSSL version : OpenSSL 1.0.2j  26 Sep 2016
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 8.35 2014-04-04
Running on PCRE version : 8.35 2014-04-04
PCRE library supports JIT : no (USE_PCRE_JIT not set)
Built with Lua version : Lua 5.3.1
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT 
IP_FREEBIND
Built with network namespace support

Available polling systems :
     epoll : pref=300,  test result OK
      poll : pref=200,  test result OK
    select : pref=150,  test result OK
Total: 3 (3 usable), will use epoll.

Available filters :
        [COMP] compression
        [TRACE] trace
        [SPOE] spoe
==================================================
HA-Proxy version 1.8-dev0-439729-165 2017/01/16
Copyright 2000-2016 Willy Tarreau <[email protected]>

Build options :
  TARGET  = generic
  CPU     = generic
  CC      = gcc
  CFLAGS  = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement
  OPTIONS = 

Default settings :
  maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with transparent proxy support using: IP_TRANSPARENT IP_FREEBIND
Built with network namespace support.
Built without compression support (neither USE_ZLIB nor USE_SLZ are set).
Compression algorithms supported : identity("identity")
Encrypted password support via crypt(3): yes
Built without PCRE or PCRE2 support (using libc's regex instead)

Available polling systems :
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 2 (2 usable), will use poll.

Available filters :
        [SPOE] spoe
        [COMP] compression
        [TRACE] trace
==================================================




Thank you.

Reply via email to