Skip to main content
Skip table of contents

Get or Set Custom Fields

The following example illustrates how to get or set custom field values by using the SetCustomField and GetCustomField API.

function Flow_CustomMetaData (dpiMsg, ruleEngine)
  require 'LOG'
  local customName1 = "VPNData"
  local customValue1 = "Tunnel"
  local customValue2 = "SkypeTraffic"
  local customName2 = "Voice"
  SetCustomField(dpiMsg, customName1, customValue1);
  SetCustomField(dpiMsg, customName1, customValue2);

  SetCustomField(dpiMsg, customName2, customValue1);
  local customTable1 = {GetCustomField(dpiMsg, customName1)};
  local customTable2 = {GetCustomField(dpiMsg, customName2)};
  for k,v in pairs(customTable1) do
    EZINFO("Table 1: Value: ", v);
  for k,v in pairs(customTable2) do
    EZINFO("Table 2: Value: ", v);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.