ns3777k
ns3777k

Reputation: 41

rsyslog send logs when the remote is up

I ran into a problem. I have 2 instances of VMs running and I wanna set up logs transfering from 1 VM to another (let's label 'em as client and server). I set up everything's up. My client rsyslog contains this:

. @@192.168.174.132:515

meaning transfering local logs to 192.168.174.132 on port 515 over tcp. On the server-side I installed rsyslog-mysql and my server config contains this:

$ModLoad imtcp $InputTCPServerRun 515

I also installed loganalyzer. So, everything works great but the problem is: I shutdown the remote server and run this code several times on the client vm:

<?php

openlog("php_script_test", LOG_PID | LOG_PERROR, LOG_LOCAL0);

$access = date("Y/m/d H:i:s");
syslog(LOG_CRIT, "This is to be sent after shutdown: $access");

closelog();

And then I run the remote vm and those messages are not sent to the remote one. Is there any config options that'll make the client keep the logs locally and send 'em to the remote server when it's up? I tried to play around with $WorkDirectory option but failed. My rsyslog version is 4.6.4 and my OS is Debian 6.

Thank you.

Upvotes: 1

Views: 2589

Answers (1)

Pwu
Pwu

Reputation: 58

You can use the queuing system as explained here: http://www.rsyslog.com/doc/queues.html

Below is an example of configuring a queue on disk. Once the connection is available, it will clean the queue.

$ActionQueueType disk
$WorkDirectory /var/spool/rsyslog
$ActionQueueFilename actionRq
$ActionQueueMaxDiskSpace 1m
$ActionQueueSize 4000
$ActionQueueTimeoutEnqueue    0
$ActionResumeRetryCount -1

** Ensure that work directory is already created before rsyslog start

Upvotes: 2

Related Questions