Solved

Logging user connections ...

Posted on 2004-09-22
6
221 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 250 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 250 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 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