Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to log all processes (including the amount of CPU usage used, the time it was running for, etc...) to a txt file; preferably one entry per line as it appears in top.

The user appears to be running an abusive process via cron however I want to monitor it and be sure of the usage it is actually using on the server so to be sure and also so I have proof (with timestamps preferably too).

Cheers, K

share|improve this question

2 Answers 2

top -b gives you the ability to redirect top's output to a file. 

Another way to play around with logs is to add splunk and its linux application which monitors everything.

But in your case, the best solution is to watch cron jobs of every user and mark the abusive.

Or use ulimit and when he exceeds a threshold to give you a report.

By what mean is it abussive ?

share|improve this answer

Try this:

top -b -d <interval-in-secs> -u <username> >> /tmp/top.log &

This will write every $INTERVAL all processes run by the specified user to a logfile.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.