There are some messages that you do not want to see in the logs file. In this case I had the following:
Feb 3 11:41:05 bnmdns1 nrpe[19270]: Error: Could not complete SSL handshake. 1
Feb 3 11:41:05 bnmdns1 nrpe[19272]: Error: Could not complete SSL handshake. 1
Feb 3 11:41:13 bnmdns1 nrpe[19278]: Error: Could not complete SSL handshake. 1
Feb 3 11:41:13 bnmdns1 nrpe[19280]: Error: Could not complete SSL handshake. 1
Feb 3 11:41:15 bnmdns1 nrpe[19286]: Error: Could not complete SSL handshake. 1
To get rid of those unwanted messages add the following to /etc/syslog-ng/syslog-ng.conf
file:
filter f_nrpe {match ("Error: Could not complete SSL handshake. 1");};
destination d_nrpe { file("/var/log/nrpe.log");};
log { source(src); filter (f_nrpe); destination(d_nrpe);};
In the above example the filter and destination have nrpe names, as they should. The match statement is not taking into account the facility or severity. Be sure the name chosen doesn’t exist as another filter or destination already specified in this file. If we were to test this, at this point we would have a /var/log/messages file with “Error: Could not complete SSL handshake. 1” line as well as a /var/log/nrpe.log with the same “Error: Could not complete SSL handshake. 1” messages. We now need to exclude these messages from being logged to /var/log/messages.
In the syslog-ng.conf file there is a line that starts with “filter f_message”. We need to exclude our filter from being logged here. If the default line looks like the following:
filter f_messages { not facility(news, mail) and not filter(f_iptables); };
Change it to the following:
filter f_messages { not facility(news, mail) and not filter(f_iptables) and not filter(f_nrpe); };
The modified “f_messages” filter will now exclude anything defined in the “f_nrpe” filter. Messages with “Error: Could not complete SSL handshake. 1” in them should only be found in the defined log file as specified under “d_nrpe”.
Now, restart syslog-ng and test this by using logger command:
logger "Error: Could not complete SSL handshake. 1"
The unwanted nrpe logs should be stored in /var/log/nrpe.log