How to Configure Remote Syslog Logging: Difference between revisions

From RidgeRun Developer Wiki
mNo edit summary
(Added coloring to make it easier to figure out host / target command execution)
Line 7: Line 7:
This ''How to'' gives the basic procedure for configuring a remote syslog server (e.g. your Ubuntu desktop PC) and a client (e.g. your target hardware running a RidgeRun SDK produced file system).
This ''How to'' gives the basic procedure for configuring a remote syslog server (e.g. your Ubuntu desktop PC) and a client (e.g. your target hardware running a RidgeRun SDK produced file system).


Commands to be run on the <span style="background:#00FF00">Ubuntu host</span> have a green background.  Commands to be run on the <span style="background:#0000FF">Ubuntu host</span> have a yellow background.   
Commands to be run on the <span style="background:#FFFF00">Ubuntu host</span> have a yellow background.  Commands to be run on the <span style="background:#00FFFF">Ubuntu host</span> have an aqua background.   




Line 14: Line 14:
The changes on this side are minimal. Basically you have to tell syslogd to listen for remote messages. To enable your host computer's syslogd server to accept log data from a remote client, you need to edit the file <tt>/etc/default/syslogd</tt> and set
The changes on this side are minimal. Basically you have to tell syslogd to listen for remote messages. To enable your host computer's syslogd server to accept log data from a remote client, you need to edit the file <tt>/etc/default/syslogd</tt> and set


<pre>
<pre style="background:#00FFFF">
SYSLOGD="-r"  
SYSLOGD="-r"  
</pre>
</pre>
Line 20: Line 20:
Save the file and restart '''syslogd''' by doing:  
Save the file and restart '''syslogd''' by doing:  


<pre>
<pre style="background:#00FFFF">
sudo /etc/init.d/syslogd restart  
sudo /etc/init.d/syslogd restart  
</pre>
</pre>
Line 26: Line 26:
You host syslogd server will now accept remove log messages.
You host syslogd server will now accept remove log messages.


=== Configuring BusyBox syslogd to send messages to remote logging service ===
=== Configuring Busybox syslogd to send messages to remote logging service ===


==== Manual steps to verify functionality ====
==== Manual steps to verify functionality ====
Line 32: Line 32:
On your target hardware verify syslogd is not running
On your target hardware verify syslogd is not running


<pre  style="background:#00FF00">
<pre  style="background:#00FFFF">
target# killall -9 syslogd
killall -9 syslogd
</pre>
</pre>


Manually start syslogd enabling remote logging
Manually start syslogd enabling remote logging


<pre>
<pre style="background:#00FFFF">
REMOTE_LOGGING_SERIVCE=10.111.0.3
REMOTE_LOGGING_SERIVCE=10.111.0.3
PORT=514
PORT=514
Line 49: Line 49:
You can configure your system to automatically start the remote logging service be editing the file <tt>$DEVDIR/fs/overlay/etc/init.d/syslogd</tt> and adding
You can configure your system to automatically start the remote logging service be editing the file <tt>$DEVDIR/fs/overlay/etc/init.d/syslogd</tt> and adding


<pre>
<pre style="background:#00FFFF">
REMOTE_LOGGING_SERIVCE=10.111.0.3
REMOTE_LOGGING_SERIVCE=10.111.0.3
PORT=514
PORT=514
Line 63: Line 63:
On the target, start a simple script that add a message to the log every two seconds.  
On the target, start a simple script that add a message to the log every two seconds.  


<pre>
<pre style="background:#00FFFF">
( while sleep 2 ; do date ; done | logger -t "DATE:" ) &
( while sleep 2 ; do date ; done | logger -t "DATE:" ) &
</pre>
</pre>
Line 71: Line 71:
If you used the <tt>-L</tt> option with syslogd on the target hardware, then you can verify local logging is occurring as expected.
If you used the <tt>-L</tt> option with syslogd on the target hardware, then you can verify local logging is occurring as expected.


<pre>
<pre style="background:#00FFFF">
tail -f /var/log/messages
tail -f /var/log/messages
</pre>
</pre>
Line 79: Line 79:
To check the messages are been sent to the server:
To check the messages are been sent to the server:


<pre>
<pre style="background:#00FFFF">
tail -f /var/log/messages
tail -f /var/log/messages
</pre>
</pre>
Line 85: Line 85:
=== Debugging ===
=== Debugging ===


If remote logging is not working, use ''wireshark'' to watch the network traffic to verify that the target hardware is sending the msesages to the host computer.
If remote logging is not working, use ''wireshark'' on your Ubuntu host computer to watch the network traffic to verify that the target hardware is sending the messages to the host computer.

Revision as of 16:46, 6 September 2010

General Information

syslogd is the Linux system logging utility that take manages files in the /var/log directory.

On a typical desktop system, logging produced by local application and is saved to files on the local drive. But syslog can also be configured to receive logging from a remote client, or to send logging information to a remote syslog server.

This How to gives the basic procedure for configuring a remote syslog server (e.g. your Ubuntu desktop PC) and a client (e.g. your target hardware running a RidgeRun SDK produced file system).

Commands to be run on the Ubuntu host have a yellow background. Commands to be run on the Ubuntu host have an aqua background.


Configuring host PC syslogd server

The changes on this side are minimal. Basically you have to tell syslogd to listen for remote messages. To enable your host computer's syslogd server to accept log data from a remote client, you need to edit the file /etc/default/syslogd and set

SYSLOGD="-r" 

Save the file and restart syslogd by doing:

sudo /etc/init.d/syslogd restart 

You host syslogd server will now accept remove log messages.

Configuring Busybox syslogd to send messages to remote logging service

Manual steps to verify functionality

On your target hardware verify syslogd is not running

killall -9 syslogd

Manually start syslogd enabling remote logging

REMOTE_LOGGING_SERIVCE=10.111.0.3
PORT=514

/sbin/syslogd -R $REMOTE_LOGGING_SERIVCE:$PORT -L -O /var/log/messages           

Automatically starting remote logging

You can configure your system to automatically start the remote logging service be editing the file $DEVDIR/fs/overlay/etc/init.d/syslogd and adding

REMOTE_LOGGING_SERIVCE=10.111.0.3
PORT=514

/sbin/syslogd -R $REMOTE_LOGGING_SERIVCE:$PORT -L -O /var/log/messages           

Verifying proper operation

A simple way to add a log message every few seconds is using the Busybox logger utility. You man need to reconfigure your SDK to enable the building of the Busybox logger utility.


On the target, start a simple script that add a message to the log every two seconds.

( while sleep 2 ; do date ; done | logger -t "DATE:" ) &

Logging on target hardware

If you used the -L option with syslogd on the target hardware, then you can verify local logging is occurring as expected.

tail -f /var/log/messages

Logging on host PC

To check the messages are been sent to the server:

tail -f /var/log/messages

Debugging

If remote logging is not working, use wireshark on your Ubuntu host computer to watch the network traffic to verify that the target hardware is sending the messages to the host computer.