Added new parameter: $activate_httplog
This allows to get the full HTTP log (and TCP if not HTTP) from HAProxy,
in case you need any debug from that central point.
In case you want timers for those entries, you might want to use the
already present "$haproxy_globals_override" parameter and set its
content to:
{ 'log' => '/dev/log local0 debug' }
Change-Id: I4667317cbd453875585521b22b0ccbdb208f5353
Closes-Bug: 1733801
(cherry picked from commit 323cd64c58
)
This commit is contained in:
parent
c3df145045
commit
f0db40f296
|
@ -49,6 +49,11 @@
|
|||
# The IPv4, IPv6 or filesystem socket path of the syslog server.
|
||||
# Defaults to '/dev/log'
|
||||
#
|
||||
# [*activate_httplog*]
|
||||
# Globally activate "httplog" option (in defaults section)
|
||||
# In case the listener is NOT set to "http" mode, HAProxy will fallback to "tcplog".
|
||||
# Defaults to false
|
||||
#
|
||||
# [*haproxy_globals_override*]
|
||||
# HAProxy global option we can append to the default base set in this class.
|
||||
# If you enter an already existing key, it will override the default.
|
||||
|
@ -587,6 +592,7 @@ class tripleo::haproxy (
|
|||
$haproxy_listen_bind_param = [ 'transparent' ],
|
||||
$haproxy_member_options = [ 'check', 'inter 2000', 'rise 2', 'fall 5' ],
|
||||
$haproxy_log_address = '/dev/log',
|
||||
$activate_httplog = false,
|
||||
$haproxy_globals_override = {},
|
||||
$haproxy_daemon = true,
|
||||
$haproxy_socket_access_level = 'user',
|
||||
|
@ -836,16 +842,23 @@ class tripleo::haproxy (
|
|||
$haproxy_daemonize = {}
|
||||
}
|
||||
|
||||
$haproxy_defaults_options = {
|
||||
'mode' => 'tcp',
|
||||
'log' => 'global',
|
||||
'retries' => '3',
|
||||
'timeout' => $haproxy_default_timeout,
|
||||
'maxconn' => $haproxy_default_maxconn,
|
||||
}
|
||||
if $activate_httplog {
|
||||
$httplog = {'option' => 'httplog'}
|
||||
} else {
|
||||
$httplog = {}
|
||||
}
|
||||
|
||||
class { '::haproxy':
|
||||
service_manage => $haproxy_service_manage,
|
||||
global_options => merge($haproxy_global_options, $haproxy_daemonize, $haproxy_globals_override),
|
||||
defaults_options => {
|
||||
'mode' => 'tcp',
|
||||
'log' => 'global',
|
||||
'retries' => '3',
|
||||
'timeout' => $haproxy_default_timeout,
|
||||
'maxconn' => $haproxy_default_maxconn,
|
||||
},
|
||||
defaults_options => merge($haproxy_defaults_options, $httplog),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Added new parameter to tripleo::haproxy: activate_httplog
|
||||
This allows to activate the HTTP full logs in HAProxy.
|
||||
|
||||
fixes:
|
||||
- Fixes `bug 1733801
|
||||
<https://bugs.launchpad.net/tripleo/+bug/1733801>`__ so we can activate
|
||||
haproxy logs.
|
|
@ -115,6 +115,53 @@ describe 'tripleo::haproxy' do
|
|||
end
|
||||
end
|
||||
|
||||
describe "default Defaults for haproxy" do
|
||||
it 'should NOT activate httplog' do
|
||||
is_expected.to contain_class('haproxy').with(
|
||||
:defaults_options => {
|
||||
"mode"=>"tcp",
|
||||
"log"=>"global",
|
||||
"retries"=>"3",
|
||||
"timeout"=> [
|
||||
"http-request 10s",
|
||||
"queue 2m",
|
||||
"connect 10s",
|
||||
"client 2m",
|
||||
"server 2m",
|
||||
"check 10s",
|
||||
],
|
||||
"maxconn"=>4096,
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "activate httplog" do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:activate_httplog => true,
|
||||
})
|
||||
end
|
||||
it 'should activate httplog' do
|
||||
is_expected.to contain_class('haproxy').with(
|
||||
:defaults_options => {
|
||||
"mode"=>"tcp",
|
||||
"log"=>"global",
|
||||
"retries"=>"3",
|
||||
"timeout"=> [
|
||||
"http-request 10s",
|
||||
"queue 2m",
|
||||
"connect 10s",
|
||||
"client 2m",
|
||||
"server 2m",
|
||||
"check 10s",
|
||||
],
|
||||
"maxconn"=>4096,
|
||||
"option"=>"httplog",
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
|
@ -127,4 +174,4 @@ describe 'tripleo::haproxy' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue