diff --git a/README.md b/README.md index fa7e1073..16a2fafd 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_global_log.{n}.facility`: [required]: Must be one of the 24 standard syslog facilities (e.g. `local0`, `local1`) * `haproxy_global_log.{n}.level`: [optional]: Can be specified to filter outgoing messages (e.g. `notice`) * `haproxy_global_log.{n}.minlevel`: [optional]: Can be specified to filter outgoing messages (e.g. `notice`) -* `haproxy_global_log.{n}.format`: [optional]: Specifies the log format string to use for traffic logs (e.g. `%{+Q}o\ %t\ %s\ %{-Q}r`) * `haproxy_global_log.{n}.length`: [optional]: Can be specified to adjust message length in log (e.g. `2048`) * `haproxy_global_chroot`: [optional]: Changes current directory to `` and performs a `chroot()` there before dropping privileges * `haproxy_global_stats`: [default: See `defaults/main.yml`]: Stats declarations @@ -49,6 +48,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_global_peers.{n}.peers.{n}.listen`: [required]: IP and port for peer to listen/connect to (e.g. `192.168.0.1:1024`) * `haproxy_defaults_log`: [default: `global`]: Enable per-instance logging of events and traffic. `global` should be used when the instance's logging parameters are the same as the global ones. This is the most common usage +* `haproxy_defaults_logformat`: [optional]: Allows you to customize the logs in http mode and tcp mode (e.g. `%{+Q}o\ %t\ %s\ %{-Q}r`) * `haproxy_defaults_mode`: [default: `http`]: Set the running mode or protocol of the instance * `haproxy_defaults_source`: [optional]: Set the source address or interface for connections from the proxy * `haproxy_defaults_option`: [default: `[httplog, dontlognull]`]: Options (default) diff --git a/templates/etc/haproxy/defaults.cfg.j2 b/templates/etc/haproxy/defaults.cfg.j2 index 7a0624c1..4f52e3d4 100644 --- a/templates/etc/haproxy/defaults.cfg.j2 +++ b/templates/etc/haproxy/defaults.cfg.j2 @@ -2,6 +2,10 @@ log {{ haproxy_defaults_log }} {% endif %} +{% if haproxy_defaults_logformat is defined %} + log-format {{ haproxy_defaults_logformat }} +{% endif %} + {% if haproxy_defaults_mode != false %} mode {{ haproxy_defaults_mode }} {% endif %} diff --git a/templates/etc/haproxy/global.cfg.j2 b/templates/etc/haproxy/global.cfg.j2 index 6474cdbd..40419906 100644 --- a/templates/etc/haproxy/global.cfg.j2 +++ b/templates/etc/haproxy/global.cfg.j2 @@ -2,9 +2,6 @@ {% for log in haproxy_global_log %} log {{ log.address }}{% if log.length is defined %} len {{log.length }}{% endif %} {{ log.facility }}{% if log.level is defined %} {{log.level }}{% endif %}{% if log.minlevel is defined %} {{ log.minlevel }}{% endif %} -{% if log.format is defined %} - log-format {{ log.format }} -{% endif %} {% endfor %} {% endif %}