Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Logging user connections ...

Posted on 2004-09-22
6
Medium Priority
?
223 Views
Last Modified: 2010-04-15
Hi All,

I need a stat for my web application ... I need to know the following: user name, timestamp, some sort of machine ID.

I need to know what the number of distinct users at any time is. ie: if 5 pple log in under user 'bob' then it's till 5 connections ...

I would also like to know what the best way of logging this kind of system would be. I obviously can't just use a simple text file to log all events as there will be sync errors and entries will be mixed up ...

I can not log the entire user activity in one log entry since there are two thing that must take place; first the user logs in to the system then he choses an application, so if I log this as two entries there might be some data from other users inbetween the two log entries. I also can not log the data after the user chose an app as he might log in and wait for 5 minutes before doing anything and I need to have the exact times of log in for both. What might also happen is that the user might log in and log out without opening an application which I'd also like to log.

Any suggestions help on how to do this would be greately appreciated ...
Txs
Peter
0
Comment
Question by:Pete2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Expert Comment

by:praneetha
ID: 12123206
may be you can log your data in this record format

Id - IPAddress- SystemLogin -SystemLogout -applicationLogin- ApplicationLogout-username

so update the record(in database / textfile)...when he logs into application instead of creating a new record...

good luck
0
 
LVL 1

Accepted Solution

by:
balee earned 1000 total points
ID: 12123584
I would store this in a database table.

LOG_TABLE
-------------
ID                NUMBER   -- log id (primary key)
ACTION_ID   NUMBER   -- what kind of action the user performed (like 1 - login, 2 - logout, 3 - opened some apps etc. whatever you like to log)
USERNAME   TEXT
IPADDRESS  TEXT        -- some unique identifier with username
TIMESTAMP DATETIME -- when the action happened

Once you have done with this, you only need to implement some logging mechanism into your application (like inserts into this table when the particular events occure).
To get the number of users at a given time interval is:

select count(*) from LOG_TABLE a
where a.timestamp > XXX and a.timestamp < YYY
and a.action_id = 1
and not exists (select 1 from LOG_TABLE b where b.timestamp > XXX and b.timestamp <YYY
and b.action_id =2 and b.ipaddress = a.ipaddress and b.username = a.username)

This hasn't been tested, just an idea. It assumes that there is only one connection from a given IP address with a given username at same time. It also assumes that the action_id = 1 is used for login and 2 is for logout. This way it counts all users who has logged in in the given time interval but hasn't yet logged out.

Hope it helps
0
 
LVL 2

Expert Comment

by:SimonTocker
ID: 12131044
All this information is in the IIS logs, ther are plenty of tools out there that will help you interpret them or you could even write some your self.

Dont burden your application with things that already exist and are done in the Kernel much faster than any code we could write.

If this is for business though I would recommend purchasing WebTrends or some other such report generator, thi has complex analysis tools for usage and page flow.
0
 

Author Comment

by:Pete2003
ID: 12131224
Simon: I need to have a page in my application administrator which displays all this info .. most of my users (even admins) will not know much about IIS ... (the admins will be managers and applicaition level admins not network pple)
0
 
LVL 2

Assisted Solution

by:SimonTocker
SimonTocker earned 1000 total points
ID: 12131281
Ah I see,

Ok so you have multiple web apps ? a menu page then you go into the app by the sound of it.

This kind of info needs to be collected at the start page, and for each application, you probably need to persist the info in a database for analysis for some of the info you want and in Application (configure sql session for multiple machines if in a farm/garden), this is to hold the onscreen info.

The number of people loggin in is the kind of info for Application variables, the other stuff needs anaylysis becuase your correct all the particulars are different.

if there are five apps consider 6 Virutal directories and using Session information for each application and writing to the db in the on session start.

You will need a report to pull all the info together, and thats the hard bit but I believe that the configuration will help you write the rest.


0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question