Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1058
  • Last Modified:

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

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
areyouready344
Asked:
areyouready344
3 Solutions
 
Todd MummertCommented:

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
 
ai_ja_naiCommented:
> I see lots of messages being displayed.
what kind of messages? can you paste something?
0
 
omarfaridCommented:
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
 
Hugh FraserConsultantCommented:
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
 
areyouready344Author Commented:
Thank youu all for your helpful comments.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now