Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
There is a perl script that runs on this webserver whenever a user does something. Is there a way I log when that script runs or do something to track time and the amount of times the script runs?
You can check appropriate system logs. Since every OS maintains logs at different locations, so it depends upon which OS this webserver has? Also you can check /home/username/.bash_history file to check history of commands run by that user.
I should have specified the restrictions I have. The permissions on the server are that one group has access to apache, and a separate group is the only group that has root access. I only have access to my directory and the directory for my website, this is stored on the web server. I could request access to logs, but that could take weeks with Christmas right around the corner. Is there a way to manually log things, like over a 2 day period? Thanks, again.
Which distro i.e. operating system is there in webserver? To check, login on webserver and invoke:
Code:
uname -a
As far as I remember, a normal user can read common system logs. But as I said which distribution is there.. perhaps then people can better help you.
Also do you want to check script run logs for yourself or any other user?
FYI, system logs contains many type of log files (in Linux, common logs are maintained in /var/log/.... directory. In Solaris it's in /var/adm/... directory). Also a webserver may maintain it's logs somewhere else (I am not sure).
In the meantime, you can try:
Code:
grep <username> /var/log/*
OR
grep <username> /var/adm/*
One more thing, /home/username/.bashrc_history, contains a list of all commands user has invoked, so you can check that also.
Thank you very much for the commands. I am able to look up the commands that I have run, but I get a "Permission denied" accessing the specific logs in the log folder. I guess I could just add to that perl script so that the end it concatenates the system time to a file. The company keeps a tight lock on permissions within the server.
If you do not have permissions, then it cannot help. But still you can do:-
First check /home/username/.bash_history, using (Note: it will not show time of script run, but at least will tell you how many times script has run):-
It will list all logs entries (if available in it) when user <username> run the script. Similarly you can invoke same command for other log files as well. Take a note, in these commands, just replace the filename (marked in green) to check other log files.
Last edited by shivaa; 12-13-2012 at 02:32 PM.
Reason: Text formatting
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.