March 15, 2014

Configure a System to Log to a Remote System.

Example forward all info message to remote host 192.168.122.10.

$ vi /etc/rsyslog.conf
...
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
...
$WorkDirectory /var/lib/rsyslog # where to place spool files
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList   # run asynchronously
$ActionResumeRetryCount -1    # infinite retries if host is down
*.info @192.168.122.10:514
...

Restart rsyslog to let changes take effects.

$ service rsyslog restart

And to test it use logger tool from client.

$ logger "Hello from client"

Open /var/log/messages on server and verify.

Reference

/usr/share/doc/rsyslog-*/rsyslog_conf.html

No comments: