From f5ec5e5dcb9d892dbc73a1861b660e46c39e6594 Mon Sep 17 00:00:00 2001 From: David Bezemer Date: Tue, 21 Apr 2020 17:12:12 +0200 Subject: [PATCH] Fix default included syslog entries - Resolved issue with all messages in /var/log/messages missing on CentOS/RHEL 7.x and 8.x --- SOURCES/haproxy.syslog.amzn1 | 6 ++---- SOURCES/haproxy.syslog.amzn2 | 4 +--- SOURCES/haproxy.syslog.el6 | 4 ++-- SOURCES/haproxy.syslog.el7 | 15 +++++++++++---- SOURCES/haproxy.syslog.el8 | 15 +++++++++++---- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/SOURCES/haproxy.syslog.amzn1 b/SOURCES/haproxy.syslog.amzn1 index 9f3b6e3..da5b5a8 100644 --- a/SOURCES/haproxy.syslog.amzn1 +++ b/SOURCES/haproxy.syslog.amzn1 @@ -1,13 +1,11 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$MaxMessageSize 64k -$FileCreateMode 0600 $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" $template HAProxyAccess,"%msg%\n" local2.=info /var/log/haproxy/access.log;HAProxyAccess -local2.=notice;local2.=warning /var/log/haproxy/status.log;HAProxy local2.error /var/log/haproxy/error.log;HAProxy -local2.* ~ +local2.* /var/log/haproxy/status.log +& ~ \ No newline at end of file diff --git a/SOURCES/haproxy.syslog.amzn2 b/SOURCES/haproxy.syslog.amzn2 index 6d74145..2711074 100644 --- a/SOURCES/haproxy.syslog.amzn2 +++ b/SOURCES/haproxy.syslog.amzn2 @@ -1,13 +1,11 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$MaxMessageSize 64k -$FileCreateMode 0600 $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" $template HAProxyAccess,"%msg%\n" local2.=info /var/log/haproxy/access.log;HAProxyAccess -local2.=notice;local2.=warning /var/log/haproxy/status.log;HAProxy local2.error /var/log/haproxy/error.log;HAProxy +local2.* /var/log/haproxy/status.log local2.* stop \ No newline at end of file diff --git a/SOURCES/haproxy.syslog.el6 b/SOURCES/haproxy.syslog.el6 index 46ee067..da5b5a8 100644 --- a/SOURCES/haproxy.syslog.el6 +++ b/SOURCES/haproxy.syslog.el6 @@ -6,6 +6,6 @@ $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" $template HAProxyAccess,"%msg%\n" local2.=info /var/log/haproxy/access.log;HAProxyAccess -local2.=notice;local2.=warning /var/log/haproxy/status.log;HAProxy local2.error /var/log/haproxy/error.log;HAProxy -local2.* ~ \ No newline at end of file +local2.* /var/log/haproxy/status.log +& ~ \ No newline at end of file diff --git a/SOURCES/haproxy.syslog.el7 b/SOURCES/haproxy.syslog.el7 index cd1abc1..05d1337 100644 --- a/SOURCES/haproxy.syslog.el7 +++ b/SOURCES/haproxy.syslog.el7 @@ -5,7 +5,14 @@ $UDPServerRun 514 $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" $template HAProxyAccess,"%msg%\n" -local2.=info if $programname startswith 'haproxy' then /var/log/haproxy/access.log;HAProxyAccess -local2.emerg if $programname startswith 'haproxy' then /var/log/haproxy/error.log;HAProxy -local2.notice if $programname startswith 'haproxy' then /var/log/haproxy/status.log;HAProxy -local2.* & stop \ No newline at end of file +if $programname startswith 'haproxy' then { + if $syslogseverity == 6 then + action(type="omfile" file="/var/log/haproxy/access.log" template="HAProxyAccess") + stop + if $syslogseverity <= 3 then + action(type="omfile" file="/var/log/haproxy/error.log" template="HAProxy") + stop + if $syslogseverity <= 5 then + action(type="omfile" file="/var/log/haproxy/status.log" template="HAProxy") + stop +} \ No newline at end of file diff --git a/SOURCES/haproxy.syslog.el8 b/SOURCES/haproxy.syslog.el8 index cd1abc1..05d1337 100644 --- a/SOURCES/haproxy.syslog.el8 +++ b/SOURCES/haproxy.syslog.el8 @@ -5,7 +5,14 @@ $UDPServerRun 514 $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" $template HAProxyAccess,"%msg%\n" -local2.=info if $programname startswith 'haproxy' then /var/log/haproxy/access.log;HAProxyAccess -local2.emerg if $programname startswith 'haproxy' then /var/log/haproxy/error.log;HAProxy -local2.notice if $programname startswith 'haproxy' then /var/log/haproxy/status.log;HAProxy -local2.* & stop \ No newline at end of file +if $programname startswith 'haproxy' then { + if $syslogseverity == 6 then + action(type="omfile" file="/var/log/haproxy/access.log" template="HAProxyAccess") + stop + if $syslogseverity <= 3 then + action(type="omfile" file="/var/log/haproxy/error.log" template="HAProxy") + stop + if $syslogseverity <= 5 then + action(type="omfile" file="/var/log/haproxy/status.log" template="HAProxy") + stop +} \ No newline at end of file