Forum Discussion
mhupman_60939
Nov 07, 2011Nimbostratus
iRule Math - Square Root?
I hope I'm simply doing something wrong, but I cannot figure out how to calculate the square root of a number inside an iRule. I tried the sqrt() and pow() TCL functions, but it doesn't seem like th...
Kurt_Knochner_5
Nov 08, 2011Cirrus
But there are nearly infinite use cases for iRules. In my particular case, I am building a stats logger based on the Link Tracking CodeShare iRule (http://devcentral.f5.com/wiki/iRules.LinkTracking.ashx).
O.K. I see. My point of view is: Even if it's possible to do a lot of things with an iRule (and I have done strange things to fix broken applications), there are very often better ways to do things offsite, by logging information to an internal system and implement all the required logic there, especially if it's about statistics and other performance data. You'll have more options to implement things (other programming languages) and it does not put an extra load on the balancer.
I wanted to display the unencoded UserID on that stats page (and also include a hyperlink to our internal CMS for that UserID) and the last step of decoding the UserID is to take the square root of the encoded value :)
O.K. I see. Is there any special reason for encoding the userid in that way? Sounds a bit like security by obscurity ;-)) Please don't get me wrong !!
Regardless of my particular use case, I can't imagine there is significant overhead involved in including the rest of the math functions. TCL compatibility is touted as a feature of the iRule engine - it would be nice if it followed the spec as closely as possible.
As much as I understand your demand, I also understand F5 if they just implement what's really needed. After all this is a load balancer with an included TCL interpreter and not a fully implemented TCL interpreter with some load balancing functionality ;-))
BTW: There is another solution to your sqrt problem in V11. You can use "sideband" connections to retrieve data from an external system with TCP or UDP (http://devcentral.f5.com/wiki/iRules.sideband.ashx). So the idea would be: ask an internal system (e.g. a web service) to decode the userid with such a sideband connection. This way, you can implement whatever you need on that web service and have that functionality within an iRule.
Regards
Kurt Knochner
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