Page 1 of 1 1
Topic Options
#122274 - 2004-07-07 03:57 PM Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
I have been using KiXtart for several years now with great success. However, I need to find an more sensible solution to logging LAN users' details.
At the moment I log Username, M/C name, IP address etc to an individual file per user as they log in. What I would like to do is to write every user's details to one BIG file. I'm sure writeline() doesn't cope with shared file access so I'm looking for another solution. Can anyone help?
Thanks,
Andy

Top
#122275 - 2004-07-07 04:09 PM Re: Multiuser logging
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Is it just the case that you would like to query a users details?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#122276 - 2004-07-07 04:20 PM Re: Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
No, I'm doing that already. I just need to log every user's details into one file, rather then many separate ones. I could then query the single logfile and extract what I need. Excel is sufficient to do this particular task, so the format is not complex, just a CSV.
Top
#122277 - 2004-07-07 04:24 PM Re: Multiuser logging
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Nice'n'easy solution is to use WriteProfileString().

Use the username as the section, and it will keep all your users details together.

Unless you have an extraordinarily high level of concurrent logins you won't experience a locking problem.

If you do experience locking problems then it is time to switch to a database solution.

Keep an eye on the access times though. If the time taken to update the INI file gets out of hand you may need to split the files by using the first letter of the login in the file name or similar.

Top
#122278 - 2004-07-07 04:26 PM Re: Multiuser logging
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
INI format is fine for individual files but if you want one BIG file then not a good way to go. Every time you use the APIs, the ENTIRE file is read into memory. You need a central admin script that assembles the individual INI files into a central database.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#122279 - 2004-07-07 04:30 PM Re: Multiuser logging
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Are you anting a current information only? or are you wanting a log file for history.

for current information only, look into using the writeprofilestring() command, and log current information to a central .ini file.

Code:

$ = writeprofilestring("\\server\share\logfile\log.ini","kixscriptlogging",@userid,@ipaddress0 + "," + @wksta)



you will get a ini file like this...

Code:

[kixscriptlogging]
bsmith=127.0.0.1,pc01




If you are wanting a history log file..... you could use a shell command like this, with out having to worry about opening the file in kix.

Code:

shell '%comspec% /c echo ' + @userid + ',' + @ipaddress0 + ',' + @wksta + ' >> g:\logs\log.txt'



Bryce


Edited by Bryce (2004-07-07 04:47 PM)

Top
#122280 - 2004-07-07 04:38 PM Re: Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
Yep - I use that function already in another log file. The particular one I'm talking about just requires one line per user, i.e:
@FullName, @IPAddress0, @DATE, @TIME, @UserID, @ProductType
A line of info is added to the file every time a user logs in. This would provide me with a history. How I extract it is not a big issue - it's writing it that is. I have over 600 users all concurrently logging in between 8:30 and 9am so WritePrivateProfile and WriteLine won't do as far as I can tell. I hope that answers all the Q's?

Top
#122281 - 2004-07-07 04:40 PM Re: Multiuser logging
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Should that not be two redirects?

>> g:\logs\log.txt
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#122282 - 2004-07-07 04:43 PM Re: Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
In a single-user environment, yes. I don't think that will work in a multi-user one. You'll get a file sharing error. Someone correct me if I'm wrong.
Top
#122283 - 2004-07-07 04:46 PM Re: Multiuser logging
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Quote:

Should that not be two redirects?

>> g:\logs\log.txt




yes you are correct that should be >>


Edited by Bryce (2004-07-07 04:47 PM)

Top
#122284 - 2004-07-07 04:50 PM Re: Multiuser logging
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Might be an idea then to write the information into a access database and then you can query the database. Also multi user use wont effect the database. Dont ask how cause im naff with database, so its just theory..
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#122285 - 2004-07-07 04:59 PM Re: Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
Yep - that's what I was expecting to hear. I don't think you can multiuser-write to a text file. This kind of answers my question. An Access DB would be far easier to query, too. I just don't fancy writing the code...
Top
#122286 - 2004-07-07 05:06 PM Re: Multiuser logging
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Yeah, not great either. Would like to know though what you come up with

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#122287 - 2004-07-07 08:25 PM Re: Multiuser logging
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I write a file at logon named after the computer where the logon occurs. The file is written to a hidden share on the logonserver authenticating the user. An admin program walks the DC's hidden shares and collects the files, parses them, and write the data into an Oracle database so that it can be queried.


This has been the most robust and network friendly methodology I could come up with over the years.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122288 - 2004-07-07 08:33 PM Re: Multiuser logging
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You can use the Logger() UDF which addresses this issue..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#122289 - 2004-07-07 09:46 PM Re: Multiuser logging
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Andy,

Doing as Howard is doing it is also how I would do it, especially if you're keeping history in the log files.

Kent,
Logger won't get Andy where he wants to be, that is just a log file writing udf, but Andy is asking/wanting more then that.

Top
#122290 - 2004-07-08 04:50 AM Re: Multiuser logging
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I'd keep track of the user-logins on a per-computer basis in a central location, then once a day aggregate the data.

Alternatively, and preferable, updates derectly into a database (MS Access has a 255 concurrent user limit and anything over 10 concurrent users is supposed to be very slow and prone to errors). Better use the free MSDA or open-source databases.
_________________________
There are two types of vessels, submarines and targets.

Top
#122291 - 2004-07-08 08:59 AM Re: Multiuser logging
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
Thanks for all your suggestions guys. It looks as if Howard's method is the one I'm going to use. I still think it's a bit clunky, but at least it'll work and it's better than anything else I can come up with!
Andy

Top
#122292 - 2004-07-08 11:18 AM Re: Multiuser logging
kasul Offline
Fresh Scripter
*****

Registered: 2001-12-03
Posts: 41
Loc: Hannover / Germany
yes, Howards way seems to be the Best.

We let the clients collect User and Client data at Login, writing this little Files to some Servers, collecting and parsing them by some scheduled scripts into MYSQL aprox. all 2 hours.

all written in Kix, using kix/Kixforms to display queries etc.

_________________________
german native-> poor english sysadmin-> poor german...

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1172 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.078 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org