Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Server Activity via SSH
PostPosted: Sun Aug 22, 2010 4:06 pm 
Offline
Senior Newbie

Joined: Mon Jun 30, 2008 4:39 pm
Posts: 15
Website: http://www.thezach.net
Location: Kalamazoo, MI
Is there a way I can view live server activity via SSH. Like failed logins, apache errors, etc?


Top
   
 Post subject:
PostPosted: Sun Aug 22, 2010 4:30 pm 
Offline
Senior Newbie

Joined: Wed Aug 18, 2010 9:50 pm
Posts: 6
Website: http://lesharris.com/
Location: Olympia, WA
Poor Man's System Monitoring:

Get gnu screen. Create N terminals in screen where N is the number of things you want to track.

In each terminal do:

tail -f /var/log/<log file for what you want to track>.log

So to view many general events I would tail syslog like this:
tail -f /var/log/syslog

We can certainly get more sophisticated than this but this does give you a live view of what's going on on your server with minimal setup.


Top
   
 Post subject:
PostPosted: Sun Aug 22, 2010 4:54 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
A couple refinements:

Using -F instead of -f will entice tail to deal with log rotation; by default, -f follows the file by descriptor, instead of by name.

You can also tail more than file per incantation... e.g. you can "tail -F /var/log/syslog /var/log/exim4/mainlog". This is especially handy with web logs split across virtual hosts, like tail -F /srv/www/*/logs/access.log

But yes, tail is the bomb.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Sun Aug 22, 2010 5:04 pm 
Offline
Senior Newbie

Joined: Mon Jun 30, 2008 4:39 pm
Posts: 15
Website: http://www.thezach.net
Location: Kalamazoo, MI
It does not seen to be updating the screen as things happen.


Top
   
 Post subject:
PostPosted: Sun Aug 22, 2010 5:53 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
I'm running
Code:
tail -F /var/log/{auth.log,apache2/{*-,}error.log,daemon.log,exim4/mainlog,fail2ban.log,debug,messages}

all the time inside a screen session, and I assure you it works as intended.
If you're planning to pipe it through grep before display, make sure to use --line-buffered argument to it.


Top
   
PostPosted: Tue Aug 24, 2010 7:14 am 
Offline

Joined: Tue Aug 24, 2010 7:07 am
Posts: 1
Website: http://www.cyberls.com
Use these simple commands when you are inside your VPS hosting or dedicated server through SSH buddy -
tail -f /var/log/messages
tail -f /usr/local/apache/logs/error_log
To be noted that, if you are on a shared hosting account, you cannot run them as only 'root' has the above privileges .

_________________
www.cyberls.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group