via API - Get All Connections on a CCR

Hi,

Is it possible to get all the connections via the API say every 30 seconds on a CCR 16GB ram.

Thanks

Tony

Why “every 30 seconds”? You’re sure to miss a lot of connections that way, since very often (read: HTTP) connections come and go. You can instead monitor the connection list, and do stuff as soon as a connection is created or destroyed. There might be some small lag between the connection creation/destruction and the API trigger, but since very often (again: HTTP), people have some idle time between connections, there’s likely time for the API application to catch up with its queue of connections to be processed.

To listen for connections, use the “listen” command on the “/ip firewall connection” menu (i.e. “/ip/firewall/connection/listen”). When a connection is destroyed, it should have an attribute called “.dead” with a value of “yes”.