How to clear ip firewall counters in script?

Hello!

This is my script

:local time [/system clock get time]
:local hour [:pick $time 0 2]
:local minute [:pick $time 3 5]

/ip firewall filter
print file="$hour.$minute-udp-testfile.txt" stats where action =log

/ip firewall filter reset-counters numbers=5

Last command

/ip firewall filter reset-counters numbers=5

doesn’t work in script but normally work in Terminal. Why?

Hi.

Try to use script only with one line
/ip firewall filter reset-counters numbers=5

It could be a problem with the previous lines in script.

The answer is “Because 5 is valid only after ‘print’ command and can point to any firewall rule, so don’t use this command in scripts”. The correct way is

/ip firewall filter reset-counters [find comment="bla-bla-bla"]

or kind of

Works!
Thank you!