Jump to content

Recommended Posts

Posted

hi,

 

apologies if this is the wrong thread, but wasn't sure where to put it.

 

i need to analyse computer usage across my school - how many times a machine is logged into/number of minutes a machine is used for etc. i could import log in log off events into excel and start grinding the figures, but wondered if anyone knew of a more

efficient/automated method please? i've seen some products like DeskTrack, ACtivTrak etc, but these are prohibitively expensive!

 

any ideas or products that could be shared would be appreciated.

 

Thanks

 

Anton

Posted

hi, thanks for your reply. i already have the log on and off scripts for users and computers, but the data is huge, excel spreadsheet with almost 250000 rows. i'm hoping there's a program/utility that can capture the data from those logs and easily manipulate it, without taking 3+ hours of processing, as excel has done for me!! :o

 

cheers though.

Posted (edited)

Syslog would be the obvious choice somehow, what filtering do you use? Any chance it can spit out logs to a syslog server? etc?

 

At a previous org we had a logon script that logged the users logging into to PC/Laptops and put in a central location text file. You could create a folder per PC/Laptop or a folder per day with each PC name. This was over 12 years ago so I can't remember the exact mechanics of how it worked. Then import that data into excel to get the usage however you want to display.

Edited by Davit2005
Posted
I deal with this by logging to a database with powershell logon/logoff scripts. The database can then be either parsed by powershell (or other scripting language of choice), exported to excel or read by a custom interface (I am in the process of rewriting the one I had to improve functionality).
Posted

the script gives text files

 

Computer, , Was logged into by, , at,03/09/2024 14:52:11

Computer, , Was logged out of by, , at,03/09/2024 14:52:48

 

i then import into excel, use formulas to calculate columns with login/off time durations. i archive the source folder each year to keep them in check! current file count for our PCs is 2158!! hence the massive excel files.

 

i just want a 'product' to do all this for me and spit out a report as grinding through excel data isn't quite what i want to spend my time doing - or have any expertise in! :D

  • Thanks 1
Posted
I deal with this by logging to a database with powershell logon/logoff scripts. The database can then be either parsed by powershell (or other scripting language of choice), exported to excel or read by a custom interface (I am in the process of rewriting the one I had to improve functionality).

 

ah, that sounds like something i'm trying to do, but don't have the expertise (looking at buying it in). surely there's a market for an off the shelf product here!!?? ;)

Posted
the script gives text files

 

Computer, , Was logged into by, , at,03/09/2024 14:52:11

Computer, , Was logged out of by, , at,03/09/2024 14:52:48

...

grinding through excel data isn't quite what i want to spend my time doing

 

This is exactly why I do it through a SQL database. let custom code churn out datasets for me in the format that I need, without having to spend anything on a 3rd party product.

Posted
Syslog would be the obvious choice somehow, what filtering do you use? Any chance it can spit out logs to a syslog server? etc?

 

At a previous org we had a logon script that logged the users logging into to PC/Laptops and put in a central location text file. You could create a folder per PC/Laptop or a folder per day with each PC name. This was over 12 years ago so I can't remember the exact mechanics of how it worked. Then import that data into excel to get the usage however you want to display.

 

logon script is the current method, but is really time consuming and clunky, so looking for other ideas, thanks for your reply though.

Posted
surely there's a market for an off the shelf product here!!?? ;)

 

Quite possibly, but what I have is heavily reliant on our use cases. As I said, I'm in the process of improving the UI and simplifying the dataset whilst cutting down on the processing that each computer does. I started with a very complex method, involving a script that continues to run, allowing for accurate usage of offline devices like laptops, and am trimming it down to what is necessary.

 

I can share the basic form of the code to connect to and log to a database if that's helpful?

Posted
the script gives text files

 

Computer, , Was logged into by, , at,03/09/2024 14:52:11

Computer, , Was logged out of by, , at,03/09/2024 14:52:48

 

i then import into excel, use formulas to calculate columns with login/off time durations. i archive the source folder each year to keep them in check! current file count for our PCs is 2158!! hence the massive excel files.

 

i just want a 'product' to do all this for me and spit out a report as grinding through excel data isn't quite what i want to spend my time doing - or have any expertise in! :D

 

You can save a step by having your log on/off scripts create a csv.

set mytime=%TIME:~0,-3%

echo LogOn,%COMPUTERNAME%,%USERNAME%,%DATE%,%mytime% >> \\Path\To\Logging\UsageLog.csv

Posted
import pathlib, csv
from datetime import datetime

# date format used is day/month/year hours:minutes:seconds
date_format = '%d/%m/%Y %H:%M:%S'

def parseline(row):
   # login is True or False (logout)
   login = (row[2] == ' Was logged into by')
   computer = row[1]
   user = row[3]
   time = datetime.strptime(row[5],date_format)
   print(login,computer,user,time)
   # if login then store computer/user time of login, if logout then match to login and take difference, then delete login
   if login:
       login_store[(computer, user)] = time
       print(login_store)
   else:
       login_time = login_store[(computer, user)]
       total_time = time - login_time
       print(total_time)
       del login_store[(computer, user)]
       if computer in computer_usage:
           computer_usage[computer] += total_time
       else:
           computer_usage[computer] = total_time
       if user in user_usage: 
           user_usage[user] += total_time
       else:
           user_usage[user] = total_time

# Read all csv files
# find csv files in current dir
files = [f for f in pathlib.Path().glob("./*.csv")]
print (files)

# init output directories
computer_usage = {}
user_usage = {}
login_store = {}

for file in files:
   with open(file, "r") as csvfile:
       f = csv.reader(csvfile)
       for row in f:
           parseline(row)

print(computer_usage)
print(user_usage)
print(login_store)

Posted

This is something that's been on my project ideas list for a while. We also collect timestamps into text files from each logon and logoff, but don't have any reporting layer over it.

 

I've often wondered whether RRDtool could be of use (it would be a good excuse to learn the basics of it!) but I think that assumes datapoints coming it at regular time intervals, which for 100s computers is going to be quite burdonsome. There's also the issue of multiple concurrent user sessions: someone who has left themselves signed in might muddy your data.

 

If it were me I'd begin by putting together some scriting that totals up the session duration for each computer each day from the log files, and add those to the computers' running totals for the current week/month/term as held in a spreadsheet (current week/month rather than the last 7/30 days, since that's simpler without needing a proper database).

Posted
hi,

 

apologies if this is the wrong thread, but wasn't sure where to put it.

 

i need to analyse computer usage across my school - how many times a machine is logged into/number of minutes a machine is used for etc. i could import log in log off events into excel and start grinding the figures, but wondered if anyone knew of a more

efficient/automated method please? i've seen some products like DeskTrack, ACtivTrak etc, but these are prohibitively expensive!

 

any ideas or products that could be shared would be appreciated.

 

Thanks

 

Anton

 

What's the ultimate goal and reason you are trying to work out usage?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...