Community discussions

MikroTik App
 
kovalr
just joined
Topic Author
Posts: 8
Joined: Wed Apr 26, 2017 9:13 pm

How to clear ip firewall counters in script?

Wed Apr 04, 2018 4:59 pm

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?
 
gustavomam
Trainer
Trainer
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Re: How to clear ip firewall counters in script?

Thu Apr 05, 2018 1:17 pm

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.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: How to clear ip firewall counters in script?

Thu Apr 05, 2018 1:22 pm

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
 
kovalr
just joined
Topic Author
Posts: 8
Joined: Wed Apr 26, 2017 9:13 pm

Re: How to clear ip firewall counters in script?

Fri Apr 06, 2018 12:21 am

Works!
Thank you!

Who is online

Users browsing this forum: pepe262 and 35 guests