Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
timpoismans
Specialist
Specialist

Defining sessions based on a log file

Hi all

I've encountered the following problem:
I got a logfile that logs user info based on actions on a webpage. User is defined by UserID, time by PageAccessTime. 
Sessions_1.png

Now I need to define sessions. I was wondering if this would be possible based on the UserID and column 'Page'.

The thought behind it is: Sessions start with a "Login". As long as we don't encounter a new  "Login", we remain in the same session. When we encounter a new "Login", we have a new session. There's also need for a check on UserID when encountering a new "Login" to see if it's the same UserID. If not, the sessioncounter needs to reset.

If you need more info, please ask. Any help is appreciated, thanks in advance.

 

Kind regards,

Tim P.

4 Replies
marcus_sommer

I think I wouldn't try to calculate it within the UI else within the datamodel. Maybe something an

autonumber(UserID & '|' & PageAccessTime) as SessionID

will be enough. If not you could also use interrecord-functions like peek() and/or previous() within an ordered resident-load to compare the records against eachother and set some flags.

- Marcus

timpoismans
Specialist
Specialist
Author

Yea, wasn't planning on calculating it within the UI, it was just there as an example, to give everyone an idea of what I wanted to achieve.

The "Autonumber() as SessionID" won't work, as a session has multiple PageAccesTime-values in it.

You have an example of how to do this with peek() or previous()?
I don't fully see how I can achieve this sadly.

marcus_sommer

Maybe you could adjust PageAccesTime to your needed session-definition with something like:

autonumber(UserID & '|' & floor(PageAccessTime, 1/24))

The logic by the interrecord-functions is to sort the resident-load to your KEY fields (in your case UserID and PageAccessTime) and then to check:

if(previous(UserID) = UserID, if(PageAccessTime - previous(PageAccessTime) >= ...., this, else), else)

... something in this way. Examples and a better explanation to te logic could you find here: Peek-or-Previous.

- Marcus

timpoismans
Specialist
Specialist
Author

I can't directly define a session based on the PageAccessTime. The customer doesn't want to limit the session to a specific time.

I'm left wondering if it's even possible to define a session based on the current info that I got. 
Sessions are based from "Login" to "Logout" (There's one case where we DO limit the duration of a session, but that's not the problem).

So I'd need to look at the table, 1 row at a time, check the field [Page] (or one other flag field), edit the new [Session]-field AND if needed, change the sessionnumber