Rsyslog for RHEL 7.2


#1

My rsyslog setup for Haproxy working fine. current production setup is RHEL 6.7 and haproxy 1.5.x versions.

However same setup for RHEL 7.2 and HAProxy 1.6.6 is not working. We always run separate instances for 80 and 443 on same RP servers. Binary is same for both 80 and 443 except renaming program name to haporxy-80 and haproxy-443.

working setup:

$ ps -ef | grep haproxy
www 22071 1 5 16:18 ? 00:23:01 /opt/httpd/haproxy/sbin/haproxy-80 -f /opt/httpd/haproxy-80/etc/haproxy.conf -p /var/run/haproxy-80.pid -sf 19292
wwwssl 22121 1 15 16:19 ? 00:59:42 /opt/httpd/haproxy/sbin/haproxy-ssl -f /opt/httpd//haproxy-ssl/etc/haproxy.conf -p /var/run/haproxy-ssl.pid -sf 21171

$ ls -l /etc/rsyslog.d/haproxy-*
-rw-r–r--. 1 root root 286 Jan 16 2014 /etc/rsyslog.d/haproxy-80.conf
-rw-r–r--. 1 root root 292 Jan 16 2014 /etc/rsyslog.d/haproxy-ssl.conf

$ cat /etc/rsyslog.d/haproxy-80.conf

if ($programname == ‘haproxy-80’ and $syslogseverity-text == ‘info’) then -/opt/httpd/logs/haproxy-80/haproxy-80-info.log
& ~
if ($programname == ‘haproxy-80’ and $syslogseverity-text == ‘notice’) then -/opt/httpd/logs/haproxy-80/haproxy-80-notice.log
& ~

$ cat /etc/rsyslog.d/haproxy-ssl.conf
if ($programname == ‘haproxy-ssl’ and $syslogseverity-text == ‘info’) then -/opt/httpd/logs/haproxy-ssl/haproxy-ssl-info.log
& ~
if ($programname == ‘haproxy-ssl’ and $syslogseverity-text == ‘notice’) then -/opt/httpd/logs/haproxy-ssl/haproxy-ssl-notice.log
& ~

80 instance haproxy.cfg file:

global
daemon
user www
group www
pidfile /var/run/haproxy-80.pid
log /dev/log local1 notice
log /dev/log local0 info
maxconn 50000
tune.bufsize 65536
spread-checks 5
stats socket /var/run/haproxy-80.stat mode 600 level admin
stats timeout 2m
nbproc 1
tune.comp.maxlevel 5

Pretty same for 443 instance as well.

Our intention is send logs to separate files for both 80 and 443 as well as filter out info and notice logs ( similar t apache access and error logs) as per our internal requirements. Above setup is working fine

$ ls -ltr /opt/httpd/logs/haproxy-80

-rw------- 1 root root 819055 Jul 5 22:55 haproxy-80-notice.log
-rw------- 1 root root 467127188 Jul 5 22:55 haproxy-80-info.log

$ ls -ltr /opt/httpd/logs/haproxy-ssl
-rw------- 1 root root 1079239 Jul 5 22:56 haproxy-ssl-notice.log
-rw------- 1 root root 323238292 Jul 5 22:56 haproxy-ssl-info.log

What is the problem??

We are moving to RHEL 7.x and HAProxy 1.6.6 . Same config working as above is not working for now. i can see only ‘notice’ files bu ‘info’ files are not generating. I’m suspecting $syslogseverity-text is not working as expected. If I change the rsyslog config as below then I can see all entries ( both info and notice) in a single file. I really want to separate logs like our current setup

$ cat /etc/rsyslog.d/haproxy-80.conf
if $programname == ‘haproxy-80’ then -/opt/haproxy/log/haproxy-80/haproxy-80-info.log ( is working)

Can you help if anything wrong in new setup?

Srinivas Kotaru


#2

Hi Guys

any help here? really appreciated your help

Srinivas Kotaru