to stop those events I used & ~ at the end of the script. This fixed my bug, but my functional tests are not able to capture these events. I am using Logstash for this. So my fix is to stop the Rsyslog to push the events to Logstash, And my tests use the events from the Logstash which are pushed by the Rsyslog. So I need to figure out how to enable Logstash to receive these events from the Rsyslog without sending those events to var/log/messages.
# Send mediaquality logs to separate file
#
# # create a channel for log rotation
$outchannel <path for the outchannel>
#
# # create a template to output just the mse event json
$template rawMsgFormat,"%msg%\n"
#
local5.* :omfile:$mediaquality;rawMsgFormat
& stop