PROXY:atomic_counter_create()
Creates an atomic counter with a specific name. This counter is sharable among different processes of one virtual server. The creator process has the ownership. All the other processes within the same VS can perform all the operations except destroy. Each VS can create up to 255 counters.
Syntax
PROXY:atomic_counter_create(counter_name);
Arguments
| Name | Description |
|---|---|
| counter_name |
A Lua string as the name of the counter. This parameter is mandatory. |
Events
Applicable in the following events:
-
RULE_INIT
-
HTTP events: HTTP_REQUEST, HTTP_RESPONSE ,HTTP_DATA_REQUEST, HTTP_DATA_RESPONSE ,BEFORE_AUTH, AUTH_RESULT, COOKIE_BAKE
-
SSL events: CLIENTSSL_HANDSHAKE, SERVERSSL_HANDSHAKE, CLIENTSSL_RENEGOTIATE, SERVERSSL_RENEGOTIATE
-
TCP events: TCP_ACCEPTED, TCP_CLOSED, SERVER_CONNECTED, SERVER_CLOSED, VS_LISTENER_BIND, SERVER_BEFORE_CONNECT
-
WAF events: WAF_REQUEST_BEFORE_SCAN,WAF_RESPONSE_BEFORE_SCAN,WAF_REQUEST_ATTACK_DETECTED,WAF_RESPONSE_ATTACK_DETECTED
Example
when HTTP_REQUEST {
counter_name = "DemoCounter1"
ret = PROXY:atomic_counter_create(counter_name)
if ret then
debug("===>>atomic_counter_create success:[%s]\n",counter_name)
else
debug("===>>atomic_counter_create failed:[%s]\n",counter_name)
end
}
Supported Version
FortiADC version 7.6.0 and later.