Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6539: add logging options to load-balancer reverse-proxy (backport #3753) #4080

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions data/templates/load-balancing/haproxy.cfg.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
### Autogenerated by load-balancing_reverse-proxy.py ###

global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
Expand All @@ -11,6 +9,11 @@ global
daemon

{% if global_parameters is vyos_defined %}
{% if global_parameters.logging is vyos_defined %}
{% for facility, facility_config in global_parameters.logging.facility.items() %}
log /dev/log {{ facility }} {{ facility_config.level }}
{% endfor %}
{% endif %}
{% if global_parameters.max_connections is vyos_defined %}
maxconn {{ global_parameters.max_connections }}
{% endif %}
Expand Down Expand Up @@ -66,6 +69,11 @@ frontend {{ front }}
{% endif %}
{% if front_config.redirect_http_to_https is vyos_defined %}
http-request redirect scheme https unless { ssl_fc }
{% endif %}
{% if front_config.logging is vyos_defined %}
{% for facility, facility_config in front_config.logging.facility.items() %}
log /dev/log {{ facility }} {{ facility_config.level }}
{% endfor %}
{% endif %}
mode {{ front_config.mode }}
{% if front_config.tcp_request.inspect_delay is vyos_defined %}
Expand Down Expand Up @@ -165,6 +173,11 @@ backend {{ back }}
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
{% endif %}
{% if back_config.logging is vyos_defined %}
{% for facility, facility_config in back_config.logging.facility.items() %}
log /dev/log {{ facility }} {{ facility_config.level }}
{% endfor %}
{% endif %}
mode {{ back_config.mode }}
{% if back_config.http_response_headers is vyos_defined %}
Expand Down
10 changes: 10 additions & 0 deletions interface-definitions/include/haproxy/logging.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- include start from haproxy/logging.xml.i -->
<node name="logging">
<properties>
<help>Logging parameters</help>
</properties>
<children>
#include <include/syslog-facility.xml.i>
</children>
</node>
<!-- include end -->
3 changes: 3 additions & 0 deletions interface-definitions/load-balancing_reverse-proxy.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</leafNode>
#include <include/generic-description.xml.i>
#include <include/listen-address.xml.i>
#include <include/haproxy/logging.xml.i>
#include <include/haproxy/mode.xml.i>
#include <include/port-number.xml.i>
#include <include/haproxy/rule-frontend.xml.i>
Expand Down Expand Up @@ -91,6 +92,7 @@
<defaultValue>round-robin</defaultValue>
</leafNode>
#include <include/generic-description.xml.i>
#include <include/haproxy/logging.xml.i>
#include <include/haproxy/mode.xml.i>
#include <include/haproxy/http-response-headers.xml.i>
<node name="http-check">
Expand Down Expand Up @@ -254,6 +256,7 @@
<help>Global perfomance parameters and limits</help>
</properties>
<children>
#include <include/haproxy/logging.xml.i>
<leafNode name="max-connections">
<properties>
<help>Maximum allowed connections</help>
Expand Down
Loading