Hi, I created the rule to forward to accounting, then created one user with dst-address being his IP and comment = user1. I copied and paste the script you supplied to scheduler (winbox) and set it to run every 5seconds to test. I used the script below:
Yes 2.9.46
I did the change…still nothing. Also the under the run count under scripts in winbox when I click run script it doesn’t increase
:local sum; :local traf;
:set sum 0
/ip firewall rule accounting {
:foreach i in [find] do={:incr sum}
:for i from=1 to=$sum do={
:set traf [get [find comment=("user" . $i)]
bytes]
:set traf ($traf/1)
:if ($traf>1) do={:log info ("user" . $i . " exceeded 1Gb limit!")}
}
}
Any other ideas? I created an accounting chain, ran through all the IPs used in my network and then return chain. For some reason the script doesn’t want to execute.
yeh thats true, the script is for old version!
any how i’v fixed it for you but dont forget to adjust the value of “users” depend on how many users you have, also dont forget to change $traf/1 to $traf/1073741824
:local users
:local traf
:local i
:set users 1
/ip fire filter
:for i from=1 to=$users do={
:set traf [get [/ip fire filter find comm ("user" . $i)] bytes]
:set traf ($traf/1)
:if ($traf>1) do={:log info ("user" . $i . " exceeded 1Gb limit!")}
}