Merge pull request #26 from ingben/feature/log-format

Adds support for log-format configuration
This commit is contained in:
puneet kandhari 2015-09-23 10:13:50 -05:00
commit a8896cb7bf
2 changed files with 11 additions and 0 deletions

View file

@ -95,6 +95,9 @@ defaults
{%- if 'options' in salt['pillar.get']('haproxy:defaults', {}) -%}
{{- render_list_of_dictionaries('option', salt['pillar.get']('haproxy:defaults:options')) }}
{%- endif %}
{%- if 'logformat' in salt['pillar.get']('haproxy:defaults', {}) %}
log-format {{ salt['pillar.get']('haproxy:defaults:logformat') }}
{%- endif %}
{%- if 'maxconn' in salt['pillar.get']('haproxy:defaults', {}) %}
maxconn {{ salt['pillar.get']('haproxy:defaults:maxconn') }}
{%- endif %}
@ -152,6 +155,9 @@ listen {{ listener[1].get('name', listener[0]) }}
{%- if 'mode' in listener[1] %}
mode {{ listener[1].mode }}
{%- endif %}
{%- if 'logformat' in listener[1] %}
log-format {{ listener[1].logformat }}
{%- endif %}
{%- if 'uniqueidformat' in listener[1] %}
unique-id-format {{ listener[1].uniqueidformat }}
{%- endif %}
@ -302,6 +308,9 @@ frontend {{ frontend[1].get('name', frontend[0]) }}
{%- if 'log' in frontend[1] %}
log {{ frontend[1].log }}
{%- endif %}
{%- if 'logformat' in frontend[1] %}
log-format {{ frontend[1].logformat }}
{%- endif %}
{%- if 'mode' in frontend[1] %}
mode {{ frontend[1].mode }}
{%- endif %}

View file

@ -39,6 +39,7 @@ haproxy:
- dontlognull
- forwardfor
- http-server-close
logformat: "%ci:%cp\\ [%t]\\ %ft\\ %b/%s\\ %Tq/%Tw/%Tc/%Tr/%Tt\\ %ST\\ %B\\ %CC\\ %CS\\ %tsc\\ %ac/%fc/%bc/%sc/%rc\\ %sq/%bq\\ %hr\\ %hs\\ %{+Q}r"
timeouts:
- http-request 10s
- queue 1m
@ -114,6 +115,7 @@ haproxy:
www-https:
bind: "*:443 ssl crt /etc/ssl/private/certificate-chain-and-key-combined.pem"
logformat: "%ci:%cp\\ [%t]\\ %ft\\ %b/%s\\ %Tq/%Tw/%Tc/%Tr/%Tt\\ %ST\\ %B\\ %CC\\ %CS\\ %tsc\\ %ac/%fc/%bc/%sc/%rc\\ %sq/%bq\\ %hr\\ %hs\\ %{+Q}r\\ ssl_version:%sslv\\ ssl_cipher:%sslc"
reqadd:
- "X-Forwarded-Proto:\\ https"
default_backend: www-backend