Chapter 8: Rules Usage

Using the REST API, the usage (amount of hits on a rule) counter of various rules in cOS Core can be retrieved. The information is sent back by cOS Core in JSON format and consists of the values that can also be provided by using the cOS Core CLI rules command.

Sending the Request

To retrieve the rule usage totals since the last system reconfigure, an HTTP GET should be sent. The URI values sent, depending on the type of rule, are as follows:

An Example JSON Reply

Below is an example of a typical JSON reply for an IP rule set with a single entry:

{
  "error":false,
  "rules":[
    {
      "index":1,
      "name":"test_log",
      "usage":0
    }
  ]
}