Forum Discussion
Logging load balancer decisions
Hi, We have LTM TMOS v11.4.0 deployed with universal persistence enabled on few pools. However, in some cases randomly it is not obeying the persistence so we need to see the actions taken by LTM to load balance particular request. Now we do not have external logging server so we need to enable all logs on LTM itself. So please let me know if there is any way to enable debug mode logs on LTM itself. Also how to access the log files. It should log client request, server response, and LTMs decisions with reason behind it e.g. persistence, load balancing algorithm etc. Also suggest if it is safe to do so at LTM level.
Thanks.
5 Replies
- Hamish
Cirrocumulus
I'm not sure you can... Unless something has changed markedly in 11.4.0 that sort of logging just isn't available.
H
- Kevin_Stewart
Employee
If I may add, there's a few things to consider:
- For things like client request and server response, you can certainly write an iRule that spits these out to local (or remote) syslog, or if you're running an F5 version that includes the Request Logging profile, that could be, by far, the easiest way to go.
-
There's no specific log metric for load balancing algorithm that I know of, but you could at least see which server node was chosen using the LB::server addr command in an iRule. Here's an exmaple:
when LB_SELECTED { log local0. [LB::server addr] }
That of course is overly basic and doesn't include any real context. Have a look at the LB::server wiki page for more information:
https://devcentral.f5.com/wiki/iRules.LB__server.ashx
-
You probably have a little more leeway with universal mode, as that generally requires an iRule to assist in the persistence. Can you please post your universal persistence iRule? There should be a way to insert additional tracking information.
-
The LTM logs, where you'll see most of this information, is at /var/log/ltm. You can see that log in the management GUI under System - Logs - Local Traffic, or if you want to see what's happening in real time, open a shell to the management interface (console or SSH) and execute the following command:
tail -f /var/log/ltm -
If you intend to capture client requests, server responses, persistence information, and more, you're going to find that local syslog will become an unsuitable solution very quickly. I highly recommend investing in a remote syslog server (ie. free Linux variants or commercial products) and enabling High Speed Logging on the LTM.
- Pranav_73262
Nimbostratus
Hi Kevin, Thanks.
Here is the iRule:
when HTTP_REQUEST { if { [string tolower [HTTP::path]] starts_with "/abcd" } { set jsess [URI::query [HTTP::uri] PARAM] if { $jsess != "" } { persist uie $jsess 180 } pool default.pool1 } else { persist none pool default.pool2 } }
==============
We do not intend to run it for longer, may be a day or two. So can we do it on local LTM it self?
We do have request logging profile option. Can it be configured to give info about load balancing decisions on LTM itself? Thanks once again.
- Kevin_Stewart
Employee
I'd add some logging and the LB_SELECTED event to your iRule:
when HTTP_REQUEST { if { [string tolower [HTTP::path]] starts_with "/abcd" } { log local0. "in special URI" set jsess [URI::query [HTTP::uri] PARAM] if { $jsess != "" } { log local0. "jsess = $jsess" persist uie $jsess 180 } log local0. "sending to default.pool1" pool default.pool1 } else { log local0. "else" persist none log local0. "sending to default.pool2" pool default.pool2 } } when LB_SELECTED { log local0. "selected: [LB::server addr]" }With that in place, tail the LTM log from the management shell and test:
tail -f /var/log/ltmI'm not 100% sure what you're going for, but the above iRule will only persist if the user requests the special URI and includes the jsession query string parameter.
- Kevin_Stewart
Employee
We do have request logging profile option. Can it be configured to give info about load balancing decisions on LTM itself?
The Request Logging profile will not capture the load balancing decision.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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