How can i count users??

What i want… easy, count the number of users in one hotspot, so when dhcp asssign a ip to one user, add one line to a file with data and hour…, so, counting lines i can count the number os users.

Sure, there will be better ways to do the same… (i have tried to save dhcp logs… but they are too longs for this use)… i have searched the forum looking for something similar, but nothing…if someone can help me i will be grateful.

{
:local usuarios [:len [ip dhcp-server lease find ]]
:local timesys [system clock get time]
:local datesys [system clock get date ]
:log error "the number of user is $usuarios, the time is $timesys, the date is $datesys "
}

i use the scheduler to tell me time to time…

/tool e-mail send server=xx.xx.xx.xx to=receiver@xxx.com from=system_name subject=“$[/system identity get name] $[/system clock get time] $[/system clock get date]” body=“The total user online at this moment is [$[/ip hotspot active print count]]”

remarks: xx.xx.xx.xx is the mail server ip.

I have thinking in that option… but you only see user in one moment… with dchp leases i can see users in one day (for example)… many of actual users of hotspot are android an iphone users (10 minutes use… and close the conection… i need to count this users too), so best solution is copy leases of dhcp at end of day to a file… but i dont know how to make it… and specially how to append in the same file from day to day…