Solved

How to redirect console messages on a linux terminal console on the remotely ssh terminal screen?

Posted on 2009-05-14
5
1,029 Views
Last Modified: 2012-08-13
When I login into my console terminal on a linux OS, I see lots of messages being displayed. When I ssh into this same server, I don't see any console messages as I would see during directly connected to the terminal console.
0
Comment
Question by:areyouready344
5 Comments
 
LVL 11

Accepted Solution

by:
climbgunks earned 200 total points
ID: 24392078

Most of these messages are written to various log files (typically in /var/log).  The most commonly used of these is /var/log/messages.   To see the recent messages, plus any new messages that show up, run the following in the background after you ssh in.

tail -f /var/log/messages &

or to be more precise, if you want to see more than just the last 10 lines...something like

tail -f -100 /var/log/messages &

and, in case the log file changes,

tail --follow=name -100 /var/log/messages &

0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24392952
> I see lots of messages being displayed.
what kind of messages? can you paste something?
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 150 total points
ID: 24393998
Critical messages are sent to files and console. If you want you can send therm to root (if logged in) or to logged in users' terminals. Please see the example below:

*.alert                      root,joey

this is done in the /etc/syslog.conf file. please see the link below for more examples

http://linux.die.net/man/5/syslog.conf
0
 
LVL 12

Assisted Solution

by:hfraser
hfraser earned 150 total points
ID: 24394012
The messages are being written to /dev/console, the physical console, which is either the local display connected to the computer, or the serial port if it was booted this way. As climbgunks mentioned, most of them are coming from syslog (or syslog-ng), which acts like a dispatcher, receiving messages and sending them to one or more destinations, including /dev/console.

You can change the way syslog is works by adding other destinations. Since an actual remote device can vary each time you connect, it's a bit problematic to add it as a destination. But if there are messages written to the console through syslog that aren't also contained in a file, you could add a new file as a target and use climbgunks's suggestion to tail the file.

Note that this only works for messages originating from syslog. If there's something writing directly to /dev/console, you're out of luck.
0
 

Author Comment

by:areyouready344
ID: 24395772
Thank youu all for your helpful comments.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now