Using API calls, you can download the statistics on the requests processed by the Filter, as well as the statistics on the volume of traffic passed through it.
Data is requested using specially designed queries. The general conventions (authorization, response codes, the *_hash methods and paginated selection) are described in the relevant section.
Available only for the
Enterpriseplan.The storage period of the statistics is set by the
RS_STORAGE_PERIOD(requests) andTS_STORAGE_PERIOD(traffic) options in the configuration file of the API. With the value0, the corresponding statistics are not saved.Data older than two hours is aggregated by hour. When selecting data, both detailed and aggregated data are used.
Request example:
curl http://api.example.com:8080/stats/v1/get_requests --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"startTime": 1730986421,
"endTime": 1730987421,
"ip": ["10.10.10.1"],
"iid": ["abad7224dfef6baee9434d470d96e3c4"],
"host": ["example.com"],
"port": [80]
}'
Optional parameters:
startTime and endTime - the start and end date in the Unix Timestamp format for which information will be requested. If startTime is not set, the data is processed starting from the first record; if endTime is not set - up to the last record;ip - the IP address of the agent;iid - the unique identifier of the agent;host - host, domain name;port - the port.The search for each parameter is performed according to the strict correspondence of each element of the list. The value null is not allowed in the lists.
Response format:
{
"status": "success",
"requestsStats": [
{
"id": integer,
"timestamp": integer,
"ip": string,
"iid": string,
"host": string,
"port": integer,
"total": integer,
"passed": {
"304": integer,
"wl": integer,
"total": integer
},
"blocked": {
"bt5": integer,
"bt6": integer,
"bt16": integer,
"total": integer
},
"failed": {
"404": integer,
"499": integer,
"5xx": integer,
"total": integer
}
},
...
]
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Response example:
{
"status": "success",
"requestsStats": [
{
"id": 1,
"timestamp": 1730986421,
"ip": "10.10.10.1",
"iid": "abad7224dfef6baee9434d470d96e3c4",
"host": "example.com",
"port": 80,
"total": 1500,
"passed": {
"304": 120,
"wl": 30,
"total": 1400
},
"blocked": {
"bt5": 1,
"bt6": 45,
"bt16": 12,
"total": 58
},
"failed": {
"404": 30,
"499": 5,
"5xx": 7,
"total": 42
}
}
]
}
id - the ID of an entry in the api database;timestamp - the date in the Unix Timestamp format;ip - the IP address of the agent;iid - the unique identifier of the agent;total - the total number of requests;passed.304 - processed with the response code 304 (from the cache);passed.wl - fell within the scope of the exclusions;blocked.bt5 - processed with an internal Mikiri WAF error;blocked.bt6 - blocked by the autoban mechanism;blocked.bt16 - blocked by the list of blocked IP addresses;failed.404 - processed with the response code 404;failed.499 - processed with the response code 499;failed.5xx - processed with a response code of the 5xx group;total (nested) - the total for the group.Request example:
curl http://api.example.com:8080/stats/v1/get_requests_summary --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"startTime": 1730986421,
"endTime": 1730987421,
"interval": 3600,
"ip": ["10.10.10.1"],
"iid": ["abad7224dfef6baee9434d470d96e3c4"],
"host": ["example.com"],
"port": [80]
}'
Required parameters:
startTime and endTime - the start and end date in the Unix Timestamp format for which information will be requested. The parameters are used only together.Optional parameters:
interval - grouping of data by the interval specified in seconds (greater than 0);ip - the IP address of the agent;iid - the unique identifier of the agent;host - host, domain name;port - the port.Response format:
Without using interval:
{
"status": "success",
"summary": {
"%HOST%": {
"%PORT%": {
"%IP%": {
"%IID%": {
"total": integer,
"passed": {"304": integer, "wl": integer, "total": integer},
"blocked": {"bt5": integer, "bt6": integer, "bt16": integer, "total": integer},
"failed": {"404": integer, "499": integer, "5xx": integer, "total": integer}
}
}
}
}
}
}
With the use of interval:
{
"status": "success",
"interval": 3600,
"summary": {
"%HOST%": {
"%TIMESTAMP%": {
"%PORT%": {
"%IP%": {
"%IID%": {
"total": integer,
"passed": {"304": integer, "wl": integer, "total": integer},
"blocked": {"bt5": integer, "bt6": integer, "bt16": integer, "total": integer},
"failed": {"404": integer, "499": integer, "5xx": integer, "total": integer}
}
}
}
}
}
}
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
%TIMESTAMP% is the start date of the interval in the Unix Timestamp format. The composition of the fields corresponds to the request statistics.
Request example:
curl http://api.example.com:8080/stats/v1/get_traffic --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"startTime": 1730986421,
"endTime": 1730987421,
"ip": ["10.10.10.1"],
"iid": ["abad7224dfef6baee9434d470d96e3c4"],
"host": ["example.com"],
"port": [80]
}'
Optional parameters:
startTime and endTime - the start and end date in the Unix Timestamp format for which information will be requested. If startTime is not set, the data is processed starting from the first record; if endTime is not set - up to the last record;ip - the IP address of the agent;iid - the unique identifier of the agent;host - host, domain name;port - the port.The search for each parameter is performed according to the strict correspondence of each element of the list. The value null is not allowed in the lists.
Response format:
{
"status": "success",
"trafficStats": [
{
"id": integer,
"timestamp": integer,
"ip": string,
"iid": string,
"host": string,
"port": integer,
"total": integer,
"inbound": integer,
"outbound": integer
},
...
]
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Response example:
{
"status": "success",
"trafficStats": [
{
"id": 1,
"timestamp": 1730986421,
"ip": "10.10.10.1",
"iid": "abad7224dfef6baee9434d470d96e3c4",
"host": "example.com",
"port": 80,
"total": 15728640,
"inbound": 5242880,
"outbound": 10485760
}
]
}
id - the ID of an entry in the api database;timestamp - the date in the Unix Timestamp format;ip - the IP address of the agent;iid - the unique identifier of the agent;total - the inbound and outbound traffic, bytes;inbound - the inbound traffic, bytes;outbound - the outbound traffic, bytes.Request example:
curl http://api.example.com:8080/stats/v1/get_traffic_summary --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"startTime": 1730986421,
"endTime": 1730987421,
"interval": 3600,
"ip": ["10.10.10.1"],
"iid": ["abad7224dfef6baee9434d470d96e3c4"],
"host": ["example.com"],
"port": [80]
}'
Required parameters:
startTime and endTime - the start and end date in the Unix Timestamp format for which information will be requested. The parameters are used only together.Optional parameters:
interval - grouping of data by the interval specified in seconds (greater than 0);ip - the IP address of the agent;iid - the unique identifier of the agent;host - host, domain name;port - the port.Response format:
Without using interval:
{
"status": "success",
"summary": {
"%HOST%": {
"%PORT%": {
"%IP%": {
"%IID%": {
"total": integer,
"inbound": integer,
"outbound": integer
}
}
}
}
}
}
With the use of interval:
{
"status": "success",
"interval": 3600,
"summary": {
"%HOST%": {
"%TIMESTAMP%": {
"%PORT%": {
"%IP%": {
"%IID%": {
"total": integer,
"inbound": integer,
"outbound": integer
}
}
}
}
}
}
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
%TIMESTAMP% is the start date of the interval in the Unix Timestamp format.