Forum Discussion

isspwk_39034's avatar
isspwk_39034
Icon for Nimbostratus rankNimbostratus
Aug 12, 2009

http_request and lb-selected event

I was experimenting F5 LTM using http_request and lb_selected events.

 

I noticed that lb_selected event may not occur for each http_request event.

 

Can you clarify what lb_selected event does?

 

Thanks.

5 Replies

  • Hi,

     

     

    LB_SELECTED (Click here) is triggered whenever a load balancing decision has been made. What are you testing with your iRule? Can you provide a sample of what you're testing and debug logs showing what you're seeing that you're not expecting?

     

     

    Aaron
  • You should be able to fire LB_SELECTED each time an HTTP request comes in. This rule:

     
      
     when HTTP_REQUEST { 
      
     log local0. "caught http request!" 
      
     } 
      
     when LB_SELECTED { 
      
     log local0. "caught LB_SELECTED!" 
      
     } 
      
     

    Produces:

    Jul 28 02:12:17 local/tmm info tmm[2160]: Rule event-test : caught http request!

    Jul 28 02:12:17 local/tmm info tmm[2160]: Rule event-test : caught LB_SELECTED!

    Jul 28 02:12:18 local/tmm info tmm[2160]: Rule event-test : caught http request!

    Jul 28 02:12:18 local/tmm info tmm[2160]: Rule event-test : caught LB_SELECTED!

    Jul 28 02:12:18 local/tmm info tmm[2160]: Rule event-test : caught http request!

    For each request. I had an old setup and browser session established that caused me some confusing results initially, so chances are good you've got something similar going on.

    -Matt
  • Hi Aaron,

     

    Thanks for helping.

     

    I was verifying on the default cookie persistence profile of my virtual server.

     

    I have a virtual server with 2 members in the pool.

     

    I attached a irule with the virtual server.

     

    My irule is as follows:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::cookie exists "USER_ID"] } then {

     

    if { [HTTP::cookie exists "BIGipServerMy_Pool"] } then {

     

    log local0. "[IP::client_addr] \t Not Yet Available \t [HTTP::cookie "USER_ID"] \t [HTTP::cookie "BIGipServerMy_Pool"] \t [HTTP::uri]"

     

    } else {

     

    log local0. "[IP::client_addr] \t Not Yet Available \t [HTTP::cookie "USER_ID"] \t\t [HTTP::uri]"

     

    }

     

    } else {

     

    log local0. "[IP::client_addr] \t Not Yet Available \t\t\t [HTTP::uri]"

     

    }

     

    }

     

    when LB_SELECTED {

     

    if { [HTTP::cookie exists "USER_ID"] } then {

     

    if { [HTTP::cookie exists "BIGipServerMy_Pool"] } then {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t [HTTP::cookie "USER_ID"] \t [HTTP::cookie "BIGipServerMy_Pool"] \t [HTTP::uri]"

     

    } else {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t [HTTP::cookie "USER_ID"] \t\t [HTTP::uri]"

     

    }

     

    } else {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t\t\t [HTTP::uri]"

     

    }

     

    }

     

    when LB_FAILED {

     

    if { [HTTP::cookie exists "USER_ID"] } then {

     

    if { [HTTP::cookie exists "BIGipServerMy_Pool"] } then {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t [HTTP::cookie "USER_ID"] \t [HTTP::cookie "BIGipServerMy_Pool"] \t [HTTP::uri]"

     

    } else {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t [HTTP::cookie "USER_ID"] \t\t [HTTP::uri]"

     

    }

     

    } else {

     

    log local0. "[IP::client_addr] \t [LB::server addr] \t\t\t [HTTP::uri]"

     

     

    ----

     

    And my log is as follows:

     

     

    Aug 12 20:08:24 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/index.cfm

     

    Aug 12 20:08:24 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/index.cfm

     

    Aug 12 20:08:24 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/login.cfm?user_id=test0001&password=password

     

    Aug 12 20:08:24 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/login.cfm?user_id=test0001&password=password

     

    Aug 12 20:08:25 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/index.cfm

     

    Aug 12 20:08:25 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.yyy /cfm/index.cfm

     

    Aug 12 20:08:25 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/login.cfm?user_id=test0002&password=password

     

    Aug 12 20:08:25 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.yyy /cfm/login.cfm?user_id=test0002&password=password

     

    Aug 12 20:08:26 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/index.cfm

     

    Aug 12 20:08:26 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/index.cfm

     

    Aug 12 20:08:26 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/login.cfm?user_id=test0003&password=password

     

    Aug 12 20:08:26 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/login.cfm?user_id=test0003&password=password

     

    Aug 12 20:08:27 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/index.cfm

     

    Aug 12 20:08:27 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.yyy /cfm/index.cfm

     

    Aug 12 20:08:27 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/login.cfm?user_id=test0004&password=password

     

    Aug 12 20:08:27 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.yyy /cfm/login.cfm?user_id=test0004&password=password

     

    Aug 12 20:08:28 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/index.cfm

     

    Aug 12 20:08:28 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/index.cfm

     

    Aug 12 20:08:28 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available /cfm/login.cfm?user_id=test0005&password=password

     

    Aug 12 20:08:28 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx /cfm/login.cfm?user_id=test0005&password=password

     

    Aug 12 20:08:29 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0001 xxxxxxxxxxxx.20480.0000 /1.htm

     

    Aug 12 20:08:29 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx test0001 xxxxxxxxxxxx.20480.0000 /1.htm

     

    Aug 12 20:08:30 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0002 yyyyyyyyyyyy.20480.0000 /2.htm

     

    Aug 12 20:08:30 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0002 yyyyyyyyyyyy.20480.0000 /login_popup.cfm?path=/2.htm

     

    Aug 12 20:08:31 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0003 xxxxxxxxxxxx.20480.0000 /3.htm

     

    Aug 12 20:08:31 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx test0003 xxxxxxxxxxxx.20480.0000 /3.htm

     

    Aug 12 20:08:32 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0004 yyyyyyyyyyyy.20480.0000 /4.htm

     

    Aug 12 20:08:32 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0004 yyyyyyyyyyyy.20480.0000 /login_popup.cfm?path=/4.htm

     

    Aug 12 20:08:33 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0005 xxxxxxxxxxxx.20480.0000 /5.htm

     

    Aug 12 20:08:33 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx test0005 xxxxxxxxxxxx.20480.0000 /5.htm

     

    Aug 12 20:08:34 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0001 xxxxxxxxxxxx.20480.0000 /6.htm

     

    Aug 12 20:08:35 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0002 yyyyyyyyyyyy.20480.0000 /7.htm

     

    Aug 12 20:08:35 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0002 yyyyyyyyyyyy.20480.0000 /login_popup.cfm?path=/7.htm

     

    Aug 12 20:08:36 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0003 xxxxxxxxxxxx.20480.0000 /8.htm

     

    Aug 12 20:08:36 tmm tmm[1807]: Rule TestRule : 10.10.13.13 137.132.xxx.xxx test0003 xxxxxxxxxxxx.20480.0000 /8.htm

     

    Aug 12 20:08:37 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0004 yyyyyyyyyyyy.20480.0000 /9.htm

     

    Aug 12 20:08:37 tmm tmm[1807]: Rule TestRule : 10.10.13.13 Not Yet Available test0004 yyyyyyyyyyyy.20480.0000 /login_popup.cfm?path=/9.htm

     

     

    Does it mean that when LB is selected in the first request, the next request by the same client will not require LB_SELECTED event?

     

    Thanks.

     

     

    wk
  • Hi Matt,

     

     

    Can you elaborate on the old setup and browser session established which resulted in some confusing result?

     

    How did you detect or prevent such setup?

     

    Thanks.

     

     

    wk
  • I got same problem. LB_SELECTED event not fired everytime, so made wrong flow in my persistence uie irule, don't know how to force it fire everytime