Forum Discussion

ejf5_26582's avatar
Icon for Nimbostratus rankNimbostratus
Apr 27, 2017

Name of iRule in variable?



We use output from iRules both for debugging purposes and also for logging. As a matter of fact the log (ltm.log) becomes pretty cluttered.Part of that is because on first sight you have no way where (i.e. which iRule) an output comes from.


In order to make things more readable I thought about including the name of the iRule in a "log local0"-message.


Is there any "system-" or "predefined" variable holding the name of the iRule? So for example when I have an iRule named "abc" this variable should hold the value "abc" whereas the same variable should hold the value "xyz" when being referenced in iRule "xyz".


Thanks much in advance for any clue. -ejf5


3 Replies

  • Looking at past questions about this there isn't such variable build in.

    If it isn't limited you might have a look at the tcl variables page:

    You do get the name of the iRule in your logs if you don't add the -noname statement.

  • would be nice to have one.   would help in debug logs as I put the version number in the name 

  • I recommend avoiding logging without requirement. If you don't intend to act one way or the other based on the logs, there is no point in logging. If you intend to capture the logs, you can use any unique word to identify the logs. Using capitalized unique word stands out easily among the logs. Example: F5-SYS-LOG. You can use the previous example within the "log local0." statement in the iRule.