Forum Discussion

JC_BW's avatar
JC_BW
Icon for Nimbostratus rankNimbostratus
Dec 30, 2016

Find current event name in irule subroutine.

I'm trying to write a subroutine that can log which event it was in when called. But I have not been able to find documentation as to which built-in variable would contain the current event name. If anyone can point me to a document that has this information or even just knows off the top of their head, I'd appreciate it.

 

I'm looking to do something like this:

 

proc log_debug args { log local0. "[IP::client_addr]; [virtual name]; [event name] -- $args" }

 

2 Replies

  • I am not aware of a specific variable that identifies the event. May be try looking under "event name" or "event info".

     

    Assuming you don't have a lot of events, you can just explicitly use the name like HTTP_REQUEST within that event, if that satisfies your requirements.

     

  • THi's avatar
    THi
    Icon for Nimbostratus rankNimbostratus

    If you need to log the event name, then put any logging statement to the iRule. The logger will insert the irule and the event names automatically into the log line, for example I'm logging the request uri with:

    log local0. "http request : [HTTP::host][HTTP::uri]"

    Resulting log line in /var/log/ltm is:

    Jan  2 08:47:00 labbigip.xxx.yyy info tmm[20170]: Rule /Testpartition/test_irule : http request : test.xxx.yyy/

    Haven't tested if it works similarly when having the logging statement within a proc. Worth trying, though.