Usage
Post Remote Log is designed to be simple to use.
$ post-remote-log -h Usage: post-remote-log [options] [classification] < log-data.txt Copyright (c) 2010 Samuel Williams <http://www.oriontransfer.co.nz/>. -c config.yaml Configuration file; defaults to /etc/post-remote-log.conf -d Run in background as a daemon. Requires daemon-exec. -v Verbose output.
Log Server
post-remote-log-server is a simple implementation using thin (which you will need to install before using it) which provides an XMLRPC log server. Here is a basic setup:
$ sudo gem install thin ... $ post-remote-log-server Dumping data to /Users/samuel/logs >> Thin web server (v1.2.7 codename No Hup) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:9080, CTRL+C to stop
Once the server is running, you can then setup the client.
Sending a Log
Now, we need to configure the client. Here is the configuration file, which I've saved as localhost-config.yaml, and assumes you are running everything on localhost.
methods:
test:
method: xmlrpc
host: localhost
port: 9080
path: "/post-remote-log"
We can now run post-remote-log client and send some data
$ tail -n 20 /var/log/system.log | post-remote-log -c localhost-config.yaml "System Log"
On the server we expect to see the following:
Writing data to 20100314_215831_345165.xml...
^C>> Stopping ...
$ cat logs/20100314_215831_345165.xml
<?xml version="1.0" encoding="UTF-8"?>
<remote_log>
... relevant log data has been snipped to protect the innocent :) ...
</remote_log>
Running as a Daemon
You can run post-remote-log as a daemon (i.e. in the background) by specifying the -d option. This ensures that if there are network connectivity issues, or network delays, they will not hold up any script that uses post-remote-log for diagnostic purposes.
Advanced Usage
post-remote-log-server is only intended as an example for setup and testing. It is highly recommended that you incorporate the log reporting scheme into your own system administration system. In this scenario, use the classification field to determine the type of data being sent.
Follow Me