Forum Discussion

hirox_127495's avatar
hirox_127495
Historic F5 Account
Dec 05, 2006

Getting server port number

I just want to get server port when I use ASM.

Normally, without ASM, we can use SERVER_CONNECTED event to do it for example. Like this.


when SERVER_CONNECTED {
  log local0. "[TCP::server_port]"
}

But different port number(8080: this is internal VS port number) is printed to the log when I use httpclass and ASM.

How can I get real server port number in iRule?

2 Replies

  • What version and hotfix are you running (b version; ls -latr /hotfix)? There have been a lot of changes between the versions.

    I think this should work for most versions of the _ASM_clientside rule:

    
    when HTTP_REQUEST_SEND {
       log local0. "tmm_ts_lbserver: $tmm_ts_lbserver / [lindex $tmm_ts_lbserver 4]"
    }

    Specifically, [lindex $tmm_ts_lbserver 4] should get you the pool member's port.

    What are you actually trying to do though? If you're trying to modify the pool the request is sent to, you should consider upgrading to 9.2.4 to take advantage of the changes in priority in the events in the _ASM_clientside rule. Actually, you should consider upgrading to 9.2.4 regardless, as there have been a lot of important ASM-related fixes built into the latest version.

    Here's a post that provides a bit more detail on the new functionality in 9.2.4 for iRules (Click here).

    Aaron