Tiny Core Base > TCB Tips & Tricks
is there a way of logging of user activities in TC?
jamtat:
What I'd like to be able to do on the lab computers I've set up with TC is log user actions. What I mean by that is I'd like, when a user starts an application, for that action, with a time stamp, to be recorded in some log file. The purpose is to help me to determine how much use the computers are getting and also to help in back-tracking issues, should any problems arise.
It seems like doing this must be possible but I'm drawing a blank thus far on how to do it. Web searches have so far not turned up much either. I should also mention that the computers get very little use--maybe they get used briefly once a day--so I'm not really concerned about ballooning log files. On rare occasions, they might get used a few times per day. Also, the systems have only one user, the default tc account and that's the account, of course, whose actions I want to monitor.
Can anyone offer a suggestion for how I might make the system write to a log file the application name and a time stamp each time a user on these machines opens and uses a program?
TIA, James
Rich:
Hi jamtat
I don't know if there are any pre-canned applications to do this, but you can do this yourself by
setting up scripts to monitor the applications of interest. I don't do scripting, but it would look
something like this:
--- Code: ---echo `date` APPLICATION_NAME started >> LOGFILE_NAME
command to start application goes here
echo `date` APPLICATION_NAME stopped >> LOGFILE_NAME
--- End code ---
jamtat:
Thanks for your input, Rich. I'm not really understanding what you mean when you say "scripts": are you talking about a bash script? So it's a bash script that first writes data to the log file, then starts the program, then writes to the log files again when the application is closed (the latter sort of recording is not needed in my case, incidentally)? Let me propose a bash script example that may be within my limited competence and call it "firefox-start":
--- Code: ---#!/bin/sh
echo `date` firefox started >> ~/LOGFILE &&
firefox &&
echo `date` firefox stopped >> ~/LOGFILE
--- End code ---
Is that the sort of script you're proposing? And that the script would then be made executable and somehow made to execute when the relevant wbar icon is clicked on?
James
Rich:
Hi jamtat
That is correct.
jamtat:
It's an interesting idea, Rich, and it does work, as I've proved by trying it on my Arch machine. It also has the virtue of writing only the particular information I need to the log file, thus keeping the file from growing to large proportions. And it could, furthermore, be quite workable in this particular situation, since there's a fairly limited number of programs I allow users to run (maybe 10?).
But there's a problem implementing it due to the non-standard design of TC. I cannot, for example, make persisting changes in /usr/bin (the location of most of the programs whose use I want to track). Then, there's the problem of things allowed/disallowed to appear in wbar (wbar is the only menu on these machines, incidentally). I know there are kludgy ways to deal with this: I could, for example, make a bunch of scripts in /mnt/sda1/tcelocal that would do the job, then, using wbarconf, remove the icons for persistent applications I've installed and replace them with icons representing the scripts I created. But that's a really convoluted and ugly solution. And I know I could accomplish something effective and similarly kludgy by adding various entries to bootlocal.sh. But I think I'll hold out and see whether something a bit more elegant and straightforward might be possible.
Then again, maybe I'm misunderstanding something about your proposal? Further input on this, Rich, or anyone else?
Thanks, James
Navigation
[0] Message Index
[#] Next page
Go to full version