Fortinet white logo
Fortinet white logo

Script Reference Guide

PROXY:atomic_counter_set(counter_name, value)

PROXY:atomic_counter_set(counter_name, value)

Sets the value specified by an atomic counter name.

Syntax

PROXY:atomic_counter_set(counter_name, value);

Arguments

Name Description
counter_name

A Lua string as the name of the counter. This parameter is mandatory. This will map to an index of an array.

value

A Lua number to be assigned to the counter.

Events

All events except: PERSISTENCE, POST_PERSIST.

Example

when HTTP_REQUEST {
        counter_name = "DemoCounter1"
        value = 10
        ret = PROXY:atomic_counter_set(counter_name, value)
       if ret then
               debug("===>>atomic_counter_set success: [%s]=[%d]\n", counter_name, value)
       else
              debug("===>>atomic_counter_set failed: [%s]=[%d]\n", counter_name, value)
       end
}

Supported Version

FortiADC version 7.6.0 and later.

PROXY:atomic_counter_set(counter_name, value)

PROXY:atomic_counter_set(counter_name, value)

Sets the value specified by an atomic counter name.

Syntax

PROXY:atomic_counter_set(counter_name, value);

Arguments

Name Description
counter_name

A Lua string as the name of the counter. This parameter is mandatory. This will map to an index of an array.

value

A Lua number to be assigned to the counter.

Events

All events except: PERSISTENCE, POST_PERSIST.

Example

when HTTP_REQUEST {
        counter_name = "DemoCounter1"
        value = 10
        ret = PROXY:atomic_counter_set(counter_name, value)
       if ret then
               debug("===>>atomic_counter_set success: [%s]=[%d]\n", counter_name, value)
       else
              debug("===>>atomic_counter_set failed: [%s]=[%d]\n", counter_name, value)
       end
}

Supported Version

FortiADC version 7.6.0 and later.