'rsyslog property filter by expression not working

I want to filter the rsyslog message by the expression. when I send the message over the udp socket, the filter works as expected. But when sending the message over the UNIX socket, the filter does not work?

if ($syslogtag == 'nginx:') then {
action(type="omfwd" target="192.168.56.133" protocol="tcp" port="514"
       StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="anon"
       queue.filename="forwarding" queue.spoolDirectory="/var/log"
       queue.size="10000" queue.type="LinkedList" queue.maxFileSize="1g" queue.SaveOnShutdown="on"
       action.resumeRetryCount="-1")
       & stop
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source