IPFIX::template

Description

This command provides the ability to create and delete user defined IPFIX message templates that may be used to send IPFIX messages to a specified destination.

Syntax

IPFIX::template create TEMPLATE_STRING
IPFIX::template delete IPFIX_TEMPLATE

IPFIX::template create TEMPLATE_STRING

  • When called with the create keyword and a valid template string, IPFIX::template create returns a IPFIX_TEMPLATE object. The IPFIX_TEMPLATE object is then used when creating an IPFIX message via the IPFIX::msg command. It is recommend to store the resulting template object in a static variable so that it is accessible for all instances of the rule. If the IPFIX_TEMPLATE object is not stored statically, the template will be regenerated each time the rule is executed.

  • The TEMPLATE_STRING consists of a space delimited list of IPFIX elements. The default elements can be listed via the “tmsh list sys IPFIX element” command. Enterprise IPFIX elements can be created via the “tmsh create ipfix element” command.

IPFIX::template delete IPFIX_TEMPLATE

  • Template objects can be deleted be via the IPFIX::template delete IPFIX_TEMPLATE command to free any resources associated with the object.

Valid During

ANY_EVENT

Examples

when RULE_INIT {
     set static::http_track_dest ""
     set static::http_track_tmplt ""
 }

 when CLIENT_ACCEPTED {
     if { $static::http_track_dest == "" } {
        # open the logging destination if it has not been, opened yet
        set static::http_track_dest [IPFIX::destination open -publisher /common/ipfix_publisher]
     }

     if { $static::http_track_tmplt == "" } {
        # if the template has not been created yet, create the template
        set static::http_track_tmplt [IPFIX::template create "flowStartSeconds sourceIPv4Address \
                                                              tcpSourcePort destinationIPv4Address \
                                                              tcpDestinationPort" ]
     }
 }

 when HTTP_REQUEST {
     # create a new message for this request
     set msg [IPFIX::msg create $static::http_track_tmplt]
     #set information in the message from the http request
     IPFIX::msg set $msg flowStartSeconds [clock seconds]
     IPFIX::msg set $msg sourceIPv4Address [IP::client_addr]
     IPFIX::msg set $msg tcpSourcePort [TCP::client_port]
 }

 when HTTP_RESPONSE_RELEASE {
     # set information in the message from the response
     IPFIX::msg set $msg destinationIPv4Address [IP::server_addr]
     IPFIX::msg set $msg tcpDestinationPort [TCP::server_port]
     # send the message
     IPFIX::destination send $static::http_track_dest $msg
 }

Change Log

@BIGIP-11.5.0

  • First introduced the command.

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.