I am having in my haproxy.cfg at defaults a log-format without timestamp for syslog. But I do not get why it is not being accepted in my defaults section.
This is my defaults which does haproxy does not accept after a reload:
48 defaults
49 log global
50 option httplog
51 option dontlognull
52 option abortonclose
53 timeout connect 5000
54 timeout client 50000
55 timeout server 50000
56 # exchange outlook mapi http
57 option accept-invalid-http-request
58 no option http-use-htx
59 # errorfile 400 /etc/haproxy/errors/400.http
60 # errorfile 403 /etc/haproxy/errors/403.http
61 # errorfile 408 /etc/haproxy/errors/408.http
62 # errorfile 500 /etc/haproxy/errors/500.http
63 # errorfile 502 /etc/haproxy/errors/502.http
64 # errorfile 503 /etc/haproxy/errors/503.http
65 # errorfile 504 /etc/haproxy/errors/504.http
66 #default log format http:
67 #log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
68 log-format "%ci:%cp %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
69 #default-server inter 20s downinter 10s init-addr none weight 100 ca-file /etc/ssl/certs/ca-roosit.crt
70 default-server inter 20s downinter 10s init-addr last,libc,none weight 100 ca-file /etc/ssl/certs/xxxxx.crt
When I move the log-format line to the top, haproxy accepts the cfg file after a reload with this config
48 defaults
49 log global
50 log-format "%ci:%cp %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
51 option httplog
52 option dontlognull
53 option abortonclose
54 timeout connect 5000
55 timeout client 50000
56 timeout server 50000
57 # exchange outlook mapi http
58 option accept-invalid-http-request
59 no option http-use-htx
60 # errorfile 400 /etc/haproxy/errors/400.http
61 # errorfile 403 /etc/haproxy/errors/403.http
62 # errorfile 408 /etc/haproxy/errors/408.http
63 # errorfile 500 /etc/haproxy/errors/500.http
64 # errorfile 502 /etc/haproxy/errors/502.http
65 # errorfile 503 /etc/haproxy/errors/503.http
66 # errorfile 504 /etc/haproxy/errors/504.http
67 #default log format http:
68 #log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
69 #default-server inter 20s downinter 10s init-addr none weight 100 ca-file /etc/ssl/certs/ca-roosit.crt
70 default-server inter 20s downinter 10s init-addr last,libc,none weight 100 ca-file /etc/ssl/certs/xxxxxxt.crt
But of course this does not makes sense since option httplog overrides it. (If I put the same line at a frontend, it is fine, so I think the syntax is ok)
haproxy 2.2