Fortinet white logo
Fortinet white logo

Script Reference Guide

PROXY:shared_table_dump()

PROXY:shared_table_dump()

Prints the current contents of the shared table for debugging purposes. This works similar to an iterator for a shared table.

Returns a pair table, which can be traversed with for [k, v]. All keys and values will be converted into strings. Returns NIL if there is any error or the table is empty.

Syntax

PROXY:shared_table_dump(table_name, [index], [count]);

Arguments

Name Description
table_name

A Lua string as the name of the shared table. This is the unique identification of a shared table. This parameter is mandatory.

The maximum length of this table name is 255.

index

A Lua integer is used as the print index. This will indicate the order of printing for all the items.

This parameter is optional. The default value is 1. The valid range is from 1 to the current entry count of the table. FortiADC will check the validity of this index and report errors for invalid entries.
Note: The item order in the hash table is not important, so there is no need to try to match the index to the item.

count

A Lua integer is used to indicate the number of items to print.

This parameter is optional. The default value is 1000 or the current entry count (whichever is smaller). The valid range is from 1 to the current entry count of the table. FortiADC will check the validity of this count and report errors for invalid entries.

The index is always processed before the count, so if only one parameter exists, then it is assumed as the index.

The actual returned count may be less than the specified value if we run out of items or if there is any error.

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 { 
	table_name = "TableDemo1" 
	index = 1 
	count = PROXY:shared_table_entry_count(table_name) 
	ret = PROXY:shared_table_dump(table_name, index, count) 
	--Or simply: 
	--ret = PROXY:shared_table_dump(table_name) 
	if ret then 
	   debug("===>>PROXY-shared_table_dump success [Table-%s]\n", table_name) 
	   for k, v in pairs(ret) do 
	      debug("===>>Key: %s Value: %s\n", k, v) 
	   end 
	else 
	   debug("===>>PROXY-shared_table_dump failed [Table-%s]\n", table_name) 
	end 
} 

Supported Version

FortiADC version 7.4.2 and later.

PROXY:shared_table_dump()

PROXY:shared_table_dump()

Prints the current contents of the shared table for debugging purposes. This works similar to an iterator for a shared table.

Returns a pair table, which can be traversed with for [k, v]. All keys and values will be converted into strings. Returns NIL if there is any error or the table is empty.

Syntax

PROXY:shared_table_dump(table_name, [index], [count]);

Arguments

Name Description
table_name

A Lua string as the name of the shared table. This is the unique identification of a shared table. This parameter is mandatory.

The maximum length of this table name is 255.

index

A Lua integer is used as the print index. This will indicate the order of printing for all the items.

This parameter is optional. The default value is 1. The valid range is from 1 to the current entry count of the table. FortiADC will check the validity of this index and report errors for invalid entries.
Note: The item order in the hash table is not important, so there is no need to try to match the index to the item.

count

A Lua integer is used to indicate the number of items to print.

This parameter is optional. The default value is 1000 or the current entry count (whichever is smaller). The valid range is from 1 to the current entry count of the table. FortiADC will check the validity of this count and report errors for invalid entries.

The index is always processed before the count, so if only one parameter exists, then it is assumed as the index.

The actual returned count may be less than the specified value if we run out of items or if there is any error.

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 { 
	table_name = "TableDemo1" 
	index = 1 
	count = PROXY:shared_table_entry_count(table_name) 
	ret = PROXY:shared_table_dump(table_name, index, count) 
	--Or simply: 
	--ret = PROXY:shared_table_dump(table_name) 
	if ret then 
	   debug("===>>PROXY-shared_table_dump success [Table-%s]\n", table_name) 
	   for k, v in pairs(ret) do 
	      debug("===>>Key: %s Value: %s\n", k, v) 
	   end 
	else 
	   debug("===>>PROXY-shared_table_dump failed [Table-%s]\n", table_name) 
	end 
} 

Supported Version

FortiADC version 7.4.2 and later.