Stop Nagios going into /var/log/messages on CentOS 7

It seems that Nagios is logging in two places on my CentOS 7 build.
Once in /var/log/nagios/nagios.log and also in /var/log/messages.

Considering I like my builds nice and tidy and don’t want contamination of my log files, I needed to filter out Nagios using rsyslog.

Because rsyslog processes it’s rules in order, we need to insert the following rule

# Stop nagios going into messages - it already has a log
if $programname == 'nagios' then stop

before:

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

Then restart rsyslogd!