Merge "Allow rsyslog to log HAProxy locally"
This commit is contained in:
commit
08455bb0ba
@ -1,6 +1,15 @@
|
||||
$ModLoad imudp
|
||||
$UDPServerRun 514
|
||||
$template Haproxy,"%msg%\n"
|
||||
local0.=info -/var/log/haproxy/haproxy.log
|
||||
local1.notice -/var/log/haproxy/haproxy-status.log
|
||||
local0.* ~
|
||||
if $programname startswith 'haproxy' then {
|
||||
# Connections are logged at level "info".
|
||||
# See https://www.haproxy.org/download/1.6/doc/configuration.txt.
|
||||
local0.=info -/var/log/haproxy/haproxy.log
|
||||
# Level "notice" will be used to indicate a server going up,
|
||||
# "warning" will be used for termination signals and definitive service
|
||||
# termination, and "alert" will be used for when a server goes down.
|
||||
# See https://www.haproxy.org/download/1.6/doc/configuration.txt.
|
||||
local1.notice -/var/log/haproxy/haproxy-status.log
|
||||
# Discard HAProxy messages to prevent further processing/logging.
|
||||
local0.*;local1.* ~
|
||||
}
|
||||
|
@ -31,10 +31,19 @@
|
||||
tags:
|
||||
- haproxy-base-config
|
||||
|
||||
# remove config file from old location (ie releases 14-18)
|
||||
- name: Delete prior haproxy logging config
|
||||
file:
|
||||
path: "/etc/rsyslog.d/99-haproxy-local-logging.conf"
|
||||
state: absent
|
||||
notify: Restart rsyslog
|
||||
tags:
|
||||
- haproxy-logging-config
|
||||
|
||||
- name: Drop haproxy logging config
|
||||
copy:
|
||||
src: "haproxy-logging.cfg"
|
||||
dest: "/etc/rsyslog.d/99-haproxy-local-logging.conf"
|
||||
dest: "/etc/rsyslog.d/10-haproxy-local-logging.conf"
|
||||
notify: Restart rsyslog
|
||||
tags:
|
||||
- haproxy-logging-config
|
||||
|
@ -56,7 +56,7 @@
|
||||
file:
|
||||
path: "{{ '/var/log/haproxy' | realpath }}"
|
||||
state: directory
|
||||
owner: haproxy
|
||||
owner: "{{ haproxy_log_directory_owner }}"
|
||||
group: adm
|
||||
mode: "0755"
|
||||
tags:
|
||||
|
@ -14,3 +14,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
haproxy_distro_packages_remove: []
|
||||
|
||||
haproxy_log_directory_owner: haproxy
|
||||
|
@ -36,3 +36,8 @@ haproxy_remove_files:
|
||||
- "/etc/apt/preferences.d/haproxy_pin.pref"
|
||||
- "/etc/apt/sources.list.d/haproxy.list"
|
||||
- "/etc/apt/sources.list.d/ppa_launchpad_net_vbernat_haproxy_1_5_ubuntu.list"
|
||||
|
||||
# On Ubuntu 16.04 and 18.04 rsyslog runs as the "syslog" user, so have the
|
||||
# HAProxy log directory be owned by the same user so that rsyslog can write
|
||||
# HAProxy's logs to that directory.
|
||||
haproxy_log_directory_owner: syslog
|
||||
|
Loading…
x
Reference in New Issue
Block a user