Forum Discussion
Bryan_38320
Nimbostratus
Jun 11, 2010access irule name from inside the irule
I have the need to use the name of an irule in the rule itself.
For example:
if { irule_name contains "bob" }
log local0. " bob's rule"
}
(I realize there is probably a better way to do the above, just trying to illustrate an example of what I'm trying to do)
- spark_86682Historic F5 AccountThere's no way to do this currently, unfortunately. You'll have to do something like have a RULE_INIT for each iRule to set the name in a global/static variable. However, we are considering adding this feature in an upcoming release. If you could elaborate on your use-case, that would be a great help to us.
- hoolio
Cirrostratus
Just to add to Spark's suggestion: you'd want to use a uniquely named global variable set in RULE_INIT as all variables declared in this event are global. - Bryan_38320
Nimbostratus
I have a customer that has a number of URL's that all essentially serve the same site but with different content based on the url. They have asked to have 4 virtual servers and a unique pool for each site. I would have preferred to do the pool selection in a single irule, but they require a unique irule per site. - hoolio
Cirrostratus
If you could use the virtual server name instead of the iRule name to determine the site, you could get this with [virtual name]. - Bryan_38320
Nimbostratus
Unfortunately, I can't use the virtual server name. There will be 4 virtual servers and lets say 40 pools. The appropriate pool will be selected based on an irule looking at the url requested by the client. Because of some other requirements, each site will have a unique rule, which is why I was hoping to use the rule name in the rule itself.
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