Solved

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

Posted on 2009-05-14
5
1,043 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SMB share across internet 15 116
Apache module 5 87
PHP website on Linux - server DNS address could not be found. 18 117
sed/awk/tail: how to read 3'de last line 4 71
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…
Suggested Courses

752 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