:local tcpt "0"
:local udpt "0"
:local other "0"
:foreach i in=[/ip firewall connection find protocol="tcp"] do={:set tcpt ($tcpt + 1)}
:foreach i in=[/ip firewall connection find protocol="udp"] do={:set udpt ($udpt + 1)}
:foreach i in=[/ip firewall connection find ((protocol!="tcp") && ( protocol!="udp"))] do={:set other ($other + 1)}
:log warning ("The number of TCP connections for " . $tcpt)
:log warning ("The number of UDP connections for " . $udpt)
:log warning ("The number of Other connections for " . $other)