ltm rule command IPFIX msgΒΆ

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



IPFIX::msg
       IPFIX::msg

       Provides the ability to create, delete and set values in an IPFIX
       message that can then be used to send IPFIX message based on processing
       in the iRule.

SYNOPSIS
       IPFIX::msg ((create IPFIX_TEMPLATE) |
			   (set IPFIX_MESSAGE IPFIX_FIELDTYPE
				   ('-pos' IPFIX_POS)? IPFIX_FIELDVALUE) |
			   (delete IPFIX_MESSAGE ))

DESCRIPTION
       Provides the ability to create, delete and set data values in an IPFIX
       message based on the provided IPFIX_TEMPLATE.

       Syntax

       IPFIX::msg create IPFIX_TEMPLATE

	   * Create an IPFIX_MESSAGE object based on the provided IPFIX_TEMPLATE.
	     It is necessary to create an IPFIX_MESSAGE before filling in the
	     values in the message.  The values may be filled in from multiple
	     events within the context of a single connection.

	     The IPFIX::msg create command returns an IPFIX_MESSAGE
	     object which is used by the IPFIX::msg set|delete and
	     IPFIX::destination send commands.

	     The IPFIX_TEMPLATE object is created via the IPFIX::template create
	     command.

       IPFIX::msg set IPFIX_MESSAGE IPFIX_FIELDTYPE (-pos IPFIX_POS) \
		  IPFIX_FIELDVALUE

	   * Sets the value of a field in an IPFIX_MESSAGE.  Fields are
	     referenced by the IPFIX element type in the template.

	     If there is more than one instance of a particular IPFIX element
	     type in a template, the optional -pos IPFIX_POS flag can be
	     specified to set the value of the correct field in the message.
	     IPFIX_POS starts from index 0.

       IPFIX:msg delete IPFIX_MESSAGE

	   * Deletes the provided IPFIX_MESSAGE.  This is not generally
	     necessary as the object is automatically destroyed when it
	     goes out of scope.

RETURN VALUE
       IPFIX::msg create returns an IPFIX_MESSAGE object that is used by the
       IPFIX::msg set|delete and IPFIX::destination send commands.

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 action action" ]
	    }
	}

	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]
	    IPFIX::msg set $msg action -pos 0 "Request"
	}

	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]
	    IPFIX::msg set $msg action -pos 1 "Response"
	    # send the message
	    IPFIX::destination send $static::http_track_dest $msg
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-11.5.0 --First introduced the command.



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