# # # # log_format_util.cfv # # # # # # # get_log_format_labels_from_log_format_info() # # # subroutine(get_log_format_labels_from_log_format_info( node log_format, bool add_device_name_labels), ( debug_message("#### get_log_format_info_labels()\n"); # This returns a node with zero or more labels of the log format info node. # KHP 06/May/2011 # add_device_name_labels is used only in r7-2! It is only true if we get labels # for the manual log format list which shows all log formats. It adds # a label with the device name only so that it can be easier find # in the log format list. node the_labels = new_node(); if (log_format?{"info"}) then ( node log_format_info = log_format{"info"}; node item; string manufacturer; string device; string label; int count = 0; bool is_regular_device_name; foreach item log_format_info ( if (item?{"manufacturer"} and (@item{"manufacturer"} ne "")) then ( manufacturer = @item{"manufacturer"}; ) # check for misspelled manfacturer else if (item?{"manfacturer"} and (@item{"manfacturer"} ne "")) then ( manufacturer = @item{"manfacturer"}; ) else ( manufacturer = "(unknown) - " . node_name(log_format); #GMF(CGI) echo("#### WARNING: @Log format " . node_name(log_format) . " has no manufacturer in info instance " . item); ); if (item?{"device"} and (@item{"device"} ne "")) then ( device = @item{"device"}; is_regular_device_name = true; ) else ( device = "(unknown) - " . node_name(log_format); is_regular_device_name = false; #GMF(CGI) echo("#### WARNING: @Log format " . node_name(log_format) . " has no device in info instance " . item); ); # Concatenate manufacturer and device if not equal if (manufacturer ne device) then ( label = manufacturer . " " . device; # Add device name label (used to enhance the manual log format list # to find a name also by device name. if (add_device_name_labels and is_regular_device_name) then ( # Add the manufacturer name in braces, otherwise we get multiple # entries of the same device name, i.e. "Firewall" @the_labels{count} = device . ' (' . manufacturer . ')'; count++; ); ) else ( label = manufacturer; ); @the_labels{count} = label; count++; ); ); # return the_labels; ));