Forum Discussion
Aug 11, 2010
Need to log pool member selected
I need some ideas on the best way to log the pool member selected during a connection. The user is under the impression x-forwarded will solve their problem... We're not using SNAT here so we're already preserving the source address... its the destination address (pool member) they want...
I was thinking of using the LB::server addr command. Any other thoughts or ideas? Or is that the best way to accomplish what I need here.
Thanks guys!
12 Replies
- naladar_65658
Altostratus
That seems like a logical choice to me. You could try:when LB_SELECTED { log local0. "[LB::server addr] was the IP that was selected." } - Cool, I'm looking to make it easy for them to view..
Could I insert it in the header so the web server admins could pull the info out without gaining access into our logs.
ty - Chris_Miller
Altostratus
Posted By iRuleYou on 08/11/2010 08:04 AM
Cool, I'm looking to make it easy for them to view..
Could I insert it in the header so the web server admins could pull the info out without gaining access into our logs.
ty
Interesting question...you insert a header on the way to the server...in this case, you haven't picked a server yet...anyone have a good way to do this? I know how to easily do it in the HTTP Response... - Hmm but you have picked the server...correct? Instead of capturing it into the log file, I was wondering if it could take the place of the x-forwarded in the header...
I'll give everyone a little more background so it makes more sense... we're actually mirroring outside VIP vlan and capturing it with a monitoring tool... We'd like to decipher which pool member a session is on so we can pinpoint issues..
Thanks! - hoolio
Cirrostratus
You can do this in the HTTP_REQUEST_SEND event:when HTTP_REQUEST_SEND { Need to force HTTP:: commands into the clientside context as the HTTP_REQUEST_SEND event is in the serverside context clientside { Insert a custom HTTP header in the request headers with the selected server IP HTTP::header insert Selected-Server [LB::server addr] } }
You could use just [LB::server] to get the pool name, IP and port instead of just the member IP with [LB::server addr].
Aaron - Chris_Miller
Altostratus
Posted By hoolio on 08/11/2010 10:12 AM You can do this in the HTTP_REQUEST_SEND event:when HTTP_REQUEST_SEND { Need to force HTTP:: commands into the clientside context as the HTTP_REQUEST_SEND event is in the serverside context clientside { Insert a custom HTTP header in the request headers with the selected server IP HTTP::header insert Selected-Server [LB::server addr] } }
You could use just [LB::server] to get the pool name, IP and port instead of just the member IP with [LB::server addr].
Aaron Nice Aaron! Is there a list somewhere that has the order in which the iRule events are processed? Obviously LB::server addr wouldn't be valid until the member is chosen...so does this get executed right after LB::selected? - Very cool man, I've been diving into the ASM lately... slick piece of gear.
Thanks again. - hoolio
Cirrostratus
I haven't seen anything comprehensive. What in particular are you looking for? It would almost need to be programmatic in order to cover all of the potential paths.
Or you could just add a log statement in every event and add it to your virtual server. You'd need to comment out the events which aren't relevant for your VS config to get the rule to load.
Aaron - JRahm
Admin
Here's one specific for basic http traffic: http://devcentral.f5.com/weblogs/jason/archive/2011/02/01/irules-http-event-order-update.aspx Click Here - @hoolio Just to study, I find myself referencing your notes and just started digging around..
@Jason Thank you sir, I appreciate it. You may want to update your old post ( http://devcentral.f5.com/weblogs/jason/archive/2009/09/08/irules-insight-http-event-order.aspxfeedback) with a link/new drawing.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects