From a6f2255b7c03d2890f4d6c673f0368a46fc96f35 Mon Sep 17 00:00:00 2001 From: David Bezemer Date: Tue, 21 Apr 2020 16:44:52 +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 Backport from master --- SOURCES/haproxy.syslog.amzn1 | 12 ++++++------ SOURCES/haproxy.syslog.amzn2 | 10 +++++----- SOURCES/haproxy.syslog.el6 | 12 ++++++------ SOURCES/haproxy.syslog.el7 | 19 +++++++++++++------ 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/SOURCES/haproxy.syslog.amzn1 b/SOURCES/haproxy.syslog.amzn1 index 67ae16d..da5b5a8 100644 --- a/SOURCES/haproxy.syslog.amzn1 +++ b/SOURCES/haproxy.syslog.amzn1 @@ -2,10 +2,10 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$template HAProxy,"%syslogtag%%msg:::drop-last-lf%\n" -$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %syslogtag%%msg:::drop-last-lf%\n" +$template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" +$template HAProxyAccess,"%msg%\n" -local2.=info /var/log/haproxy/access.log;HAProxy -local2.=notice;local2.=warning /var/log/haproxy/status.log;TraditionalFormatWithPRI -local2.error /var/log/haproxy/error.log;TraditionalFormatWithPRI -local2.* ~ +local2.=info /var/log/haproxy/access.log;HAProxyAccess +local2.error /var/log/haproxy/error.log;HAProxy +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 4ee7bf2..2711074 100644 --- a/SOURCES/haproxy.syslog.amzn2 +++ b/SOURCES/haproxy.syslog.amzn2 @@ -2,10 +2,10 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$template HAProxy,"%syslogtag%%msg:::drop-last-lf%\n" -$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %syslogtag%%msg:::drop-last-lf%\n" +$template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" +$template HAProxyAccess,"%msg%\n" -local2.=info /var/log/haproxy/access.log;HAProxy -local2.=notice;local2.=warning /var/log/haproxy/status.log;TraditionalFormatWithPRI -local2.error /var/log/haproxy/error.log;TraditionalFormatWithPRI +local2.=info /var/log/haproxy/access.log;HAProxyAccess +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 1b03d95..da5b5a8 100644 --- a/SOURCES/haproxy.syslog.el6 +++ b/SOURCES/haproxy.syslog.el6 @@ -2,10 +2,10 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$template HAProxy,"%syslogtag%%msg:::drop-last-lf%\n" -$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %syslogtag%%msg:::drop-last-lf%\n" +$template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" +$template HAProxyAccess,"%msg%\n" -local2.=info /var/log/haproxy/access.log;HAProxy -local2.=notice;local2.=warning /var/log/haproxy/status.log;TraditionalFormatWithPRI -local2.error /var/log/haproxy/error.log;TraditionalFormatWithPRI -local2.* ~ \ No newline at end of file +local2.=info /var/log/haproxy/access.log;HAProxyAccess +local2.error /var/log/haproxy/error.log;HAProxy +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 4ee7bf2..05d1337 100644 --- a/SOURCES/haproxy.syslog.el7 +++ b/SOURCES/haproxy.syslog.el7 @@ -2,10 +2,17 @@ $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 -$template HAProxy,"%syslogtag%%msg:::drop-last-lf%\n" -$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %syslogtag%%msg:::drop-last-lf%\n" +$template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" +$template HAProxyAccess,"%msg%\n" -local2.=info /var/log/haproxy/access.log;HAProxy -local2.=notice;local2.=warning /var/log/haproxy/status.log;TraditionalFormatWithPRI -local2.error /var/log/haproxy/error.log;TraditionalFormatWithPRI -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