Redirecting connections count into variable/file

Hi!

I have a question, I’m writing a script to get some mearurement data from the router. One of the should be the connections count, printed with
/ip firewall connection print count-only.

Now, does somebody have an idea how to redirect this print-out into a file or set it as a variable, I’ve tried everything from :log, to /ip firewall connection print file=xxxx count-only, and nothing worked.

Please help.

Best regards
Michal Podoski

[admin@main_gw] > :global aa [/ip route print count-only]
6
[admin@main_gw] > :environment print 
Global Variables
aa=6
Local Variables
[admin@main_gw] > :environment print 
Global Variables
aa=6
Local Variables
[admin@main_gw] >

Hope this helps.

Eugene

[@mikroHome] > :global connectioncount [/ip firewall connection print count-only]
461
[@mikroHome] > :env print

Global Variables
connectioncount=461

Thanks.

That’s the thing I need.

Best regards
Michal Podoski