Forum Discussion
local variable within same irule on all events
If I may add, and to expand on IheartF5's comments, global variables can be created anywhere and are indeed global to the entire device (other iRules, other VIPs, everything). There are good reasons to use global variables, but can also be troublesome if you're not careful. Also, while you can technically create a global variable anywhere, if you create one outside of RULE_INIT, or try to write to one later, you'll disable CMP.
All variables, other than global ones, are "connection-scoped", meaning that they exist within the span of a single TCP connection. Because of this, you're best bet is usually to create them at the absolutely lowest layer (the CLIENT_ACCEPTED event) where they're guaranteed to exist everywhere else.
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