Forum Discussion

Satoshino's avatar
Satoshino
Icon for Cirrus rankCirrus
Oct 27, 2020

Irule log session time

Hi everyone,

 

I am looking for a way to log, when it is close, a duration of an APM session via irule, do you know if it is possible to do this?

 

Thanks you

1 Reply

  • update, i create this irule:

    when ACCESS_SESSION_CLOSED {
     
        set sessionId [ACCESS::session data get session.user.sessionid]
        set startSession [ACCESS::session data get session.user.starttime]
        set endSession [clock seconds]
        set seconds = int($endSession - $startSession)
        set minutes = expr [$seconds / 60]
        set hours = expr [$minutes / 60]
        
        if { $minutes > 60 } {log local0. "the session duration is $hours hours" }
        
        else { log local0. "the session duration is $minutes minutes"}
     
    }

    but i receive this error:

    01070151:3: Rule [/Common/session_log] error: /Common/session_log:6: error: [wrong # args][set seconds = int($endSession - $startSession)]
    /Common/session_log:7: error: [wrong # args][set minutes = expr [$seconds / 60]]
    /Common/session_log:8: error: [wrong # args][set hours = expr [$minutes / 60]]

    what can be the cause?

    Thanks you