ltm rule command IPFIX templateΒΆ

iRule(1)		      BIG-IP TMSH Manual		      iRule(1)



IPFIX::template
       IPFIX::template

       Provides the ability to create and delete IPFIX message templates that
       may be used to generate IPFIX messages based on processing in the
       iRule.

SYNOPSIS
       IPFIX::template ( (create TEMPLATE_STRING) |
				 (delete 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

	   * 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.

RETURN VALUE
       IPFIX::template create TEMPLATE_STRING returns an IPFIX template object
       that is used by the IPFIX::msg create command and IPFIX::template
       delete command.

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
	}

HINTS
SEE ALSO
       IPFIX::destination, IPFIX::msg

CHANGE LOG
       @BIGIP-11.5.0 --First introduced the command.



BIG-IP				  2017-01-31			      iRule(1)