How do I setup rsyslog to send all logs to multiple remote servers?

119

From Forwarding to More than One Server;

What is important to know, however, is that the full set of directives make up an action. So you can not simply add (just) a second forwarding rule, but need to duplicate the rule configuration as well. Be careful that you use different queue file names for the second action, else you will mess up your system.

So, actually, you have to use 2 different local queues.

Configure a working directory.

$WorkDirectory /var/spool/rsyslog

Configure your forwarding rules (obsolete legacy format).

$ActionQueueType LinkedList
$ActionQueueFileName Forward1
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.* @@server1

$ActionQueueType LinkedList
$ActionQueueFileName Forward2
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.* @@server2

Configure your forwarding rules (new advanced format).

action(type="omfwd" target="server1" resumeRetryCount="-1" 
    queue.type="LinkedList" queue.filename="Forward1" queue.saveOnShutdown="on")

action(type="omfwd" target="server2" resumeRetryCount="-1" 
    queue.type="LinkedList" queue.filename="Forward2" queue.saveOnShutdown="on")
Share:
119

Related videos on Youtube

Daniele
Author by

Daniele

Updated on September 18, 2022

Comments

  • Daniele
    Daniele almost 2 years

    I'm feeling frustrating. After few day, I raise the white flag and ask for help. I've used this code sample:

    https://github.com/sht5/Android-tcp-server-and-client

    But every time I try to establish a connection the memory uses is increased by about 500KB, so if the client disconnects and then reconnects without closing the application after many attempts the memory becomes saturated.

    I have already tried various methods including cancel (true) in AsyncTask's doInbackground, close and force the socket and in, out objects to null call System.gc () but none of this worked.

    • Pawel
      Pawel almost 6 years
      This entire code looks very ugly to me, since it uses a lot of static fields. It's also rather old (4 years), so I would look for something more up to date instead of trying to make it work.
    • Daniele
      Daniele almost 6 years
      @Pawel, I understand what you mean. Unfortunately I did not find anything more up to date that would meet my needs and the available sources. Beyond the problem of memory the code works and I can communicate between different devices simultaneously and also with Windows of which I have already written a code working in Delphi. Do you know some written example better? If so, pass it to me, thank you.
  • Daniele Testa
    Daniele Testa almost 11 years
    That is actually exactly the config I used, including the different queue-files. But it still does not work. I only see logs comming to "server2" if I turn off "server1"
  • Daniele Testa
    Daniele Testa almost 11 years
    Sorry, my bad. I had some wrong firewall rules :) My original config was working after I fixed the firewall issues.
  • Aaron Copley
    Aaron Copley almost 11 years
    Firewalls will do it every time.. I should have asked about that! :) Regardless of your existing config working, how about an upvote for my efforts? This site works best when the voting system encourages participation. Please see the tour page when you get a chance.
  • Daniele Testa
    Daniele Testa almost 11 years
    Sorry, I need 15+ reputation to upvote