Forum Discussion

isavic's avatar
isavic
Icon for Nimbostratus rankNimbostratus
Feb 19, 2020

How to use virtual command in F5 rule

I would like to use "virtual" in this context of my F5 iRule but it seems like it's not working the way I want to. Irule looks like this:

when RULE_INIT {

set static::iso85832003bitFormat [ list 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 4 2 3 0 0 0 0 0 2 4 4 2 3 3 3 4 3 3 0 2 3 4 2 0 2 3 3 3 3 3 0 0 3 0 0 0 0 4 4 0 0 0 4 4 v4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 3 0 0 2 2 2 2 2 4 4 4 4 4 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 ]

# 0 for fixed size 2 for range 10 to 99 at maximum 3 for 100 to 999 at maximum and 4 for 1000 to 9999 at maximum.

set static::iso85832003bitSize [ list 0 0 19 6 16 16 16 10 16 16 8 12 14 6 4 8 4 4 140 3 3 22 32 3 3 4 4 27 8 3 16 23 11 11 9999 37 104 12 6 4 3 16 35 9999 9999 76 216 999 999 9999 9999 9999 16 48 126 9999 41 3 11 999 999 999 999 999 4 8 216 2 9 40 18 9999 9999 8 156 90 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 11 11 99 999 16 25 11 11 99 28 28 9999 9999 9999 9999 9999 144 144 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 9999 4 ]

set static::iso85832003bitType [ list 0 ab n an n n n n n n n n n n n n n n ansb n n ans b n n n n anb n n n n n n b z z anp anp n n ans ans ansb ansb ans ans ans ans ans ansb ansb ans b ans b n n n ans ans ans ans ans b b ans n an ans n ansb ansb n n n ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb n n ans b xn ans an n ans ans ans ansb ansb ansb ansb ansb ans ans ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb ansb b ]

}

when CLIENT_ACCEPTED   {

   TCP::collect 8

   set hsloneconnectrtcload [HSL::open -proto TCP -pool syslog-servers]

   ##HSL::send $hsloneconnectrtcload "(CLIENT_ACCEPTED-oneconnectrtcload) [IP::remote_addr]:[TCP::client_port] is connected\n"

   HSL::send $hsloneconnectrtcload "(CLIENT_ACCEPTED-oneconnectrtcload) virtual is connected\n"

}

 

Please advise what I'm doing wrong here.

Thanks,

Igor

1 Reply

  • HI,

    I couldn't find the virtual as command there on code, but, a simple word entry to send to log destination.

    The virtual command statement will give you current virtual name or route the traffic to another virtual server as described here:

    https://clouddocs.f5.com/api/irules/virtual.html

     

    Are you trying to write current virtual server name from iRule?

    e.g.

    HSL::send $hsloneconnectrtcload "(CLIENT_ACCEPTED-oneconnectrtcload) [virtual name] is connected\n"

    Regards.