HTTP:persist(save_tbl)
Saves the entry to the stick table.
Syntax
HTTP:persist(t);
Arguments
| Name | Description |
|---|---|
|
t |
A table specifies the operation, hash value, and server_name. |
Events
Applicable in the following events:
-
PERSISTENCE
-
POST_PERSIST
-
HTTP_REQUEST (supported since version 7.2.x)
Example
when PERSISTENCE{
cip = HTTP:client_addr()
hash_str_cip = sha512_hex(cip)
debug("-----save_tbl-----\n")
t={}
t["operation"] = "save_tbl"
t["hash_value"] = hash_str_cip
t["srv_name"] = "pool1-2"
ret = HTTP:persist(t)
if ret then
debug("hash save table success\n");
else
debug("save table failed\n");
end
t={};
t["operation"] = "save_tbl";
t["hash_value"] = "246810";
t["srv_name"] = "pool1-3";
ret = HTTP: persist(t);
if ret then
debug("===server add success\n");
else
debug("===server add fail\n");
end
}
Output:
true: success, false: failed
Note:
Due to limitations in the stick table, it only supports 16 characters in the hash value. Otherwise, we will hash it to obtain 16 bytes as index.
Supported Version
FortiADC version 5.4.x and later. In 7.2.x, function extended to HTTP_REQUEST events.