On Wed, Jan 18, 2017 at 08:14:24PM +0100, Guillaume de Lafond wrote:
>
>
>
> >> 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
> >
> > The issue is here, you are mixing "log-format" and "option httplog".
> > At first you set your custom format, but "option httplog" will reset the
> > default one.
> > Remove "option httplog" and it should work.
>
> Right, it works :) Thank you!
>
> The documentation does not say anything about the conflict between the two
> variables. And my feeling while reading it, is that the ???log-format??? wins
> against the "option httplog??? even if they are in the same section.
I think we should update the doc to mention that nowadays, "option httplog"
is just an alias for "log-format something" and that as such it overrides
any previous log-format.
> Maybe we should emit a warning about the conflict as the log-format is
> silently ignored in this case or do not allow at all to have ???option
> httplog??? (or "option tcplog") with ???log-format??? in the same section.
It's difficult to do this due to the fact that we inherit settings from
the defaults section. We don't want a frontend to emit a warning when
it uses option httplog while it had inherited the log-format from the
defaults section. However I think we could add such a warning when the
defaults section contains both since we know that by definition it does
not inherit the settings from anywhere else.
Are you interested in trying to implement this ? I think it can be done
in cfgparse.c where "httplog" is checked. There are already checks for
a previous logformat_string in order to free it, I think that we can
insert a check before this so that if curproxy == &defproxy and
logformat_string is set, then we warn that a previous log-format was
already specified in this section and will be overridden. The same
test should be added in "tcplog" and in "log-format". In fact you
just need to search "logformat_string", there are not that many.
Thanks,
Willy