ltm rule command BWC measureΒΆ

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

BWC::measure
       This command allows you to measure rate for a particular traffic flow or flows belonging to the bwc instance.

SYNOPSIS
       BWC::measure ( ('start' | 'stop')       |
			      ('identifier' ID_STRING) |
			      ('get' (rate | bytes)) )
			    (flow | (session (SESSION_STRING)?))

DESCRIPTION
       After a flow has been assigned a policy, user can start or stop measurement on a per policy basis or on a per
       flow basis. Once the measurement is started the measured bandwidth can be read by the user using 'BWC::measure
       get ..' iRules. Optionally users can direct the bandwidth measurement results to a 'log publisher' configured
       on the BIGIP system. Based on the log_publisher setting the measurement results will be logged to the log
       server indicated in the 'log_publisher'. It is usually an external high speed log server. Configuring a log
       publisher is recommended setting even though it is optional.

RETURN VALUE
VALID DURING
EXAMPLES
	To create log publisher:
		tmsh create net bwc-policy gold_user max-rate 10mbps max-user-rate 10mbps measure enabled log-publisher "/Common/my_log_publisher" log-period 2048 dynamic enabled

	To use the created log publisher:
	    when CLIENT_ACCEPTED {
		set mycookie [IP::remote_addr]:[TCP::remote_port]
		set measureID "MYSESSION"
		BWC::policy attach gold_user $mycookie
		BWC::measure identifier $measureID session
		BWC::measure start session
	    }

	    when SERVER_CONNECTED {
		TCP::collect	 set count 0
	    }

	    when SERVER_DATA {
		if {$count >= 1000}
		{
		    set rate [BWC::measure get rate session]
		    set bytes [BWC::measure get bytes session]
		    log local0. "Rate $rate/sec : Bytes $bytes : for address $mycookie" set count 0
		}

		TCP::release	 TCP::collect	  incr count
	    }

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

BIG-IP						      2020-06-23					     iRule(1)