Re: syslog lib/module for remote logging


#1

fr Francis:

You have to configure your logging server to accept remote

logs. If your source server is Unix, then it’s an easy config

on the local side to send to a remote server. If your source

is Windows, then you can send UDP packets to the remote side

but it’s more work. Is that what you’re trying to do?

Yes, no problem with the *nix server and clients.
I need the win clients to be able to send. But a pure ruby solution
would be great since i may be able to use the same program for all.

thank you and kind regards -botp


#2

Hi,

is Windows, then you can send UDP packets to the remote side

but it’s more work. Is that what you’re trying to do?

Yes, no problem with the *nix server and clients.
I need the win clients to be able to send. But a pure ruby solution would
be great since i may be able to use the same program for all.

thank you and kind regards -botp

You can try something like this:

require ‘socket’
require ‘win32/eventlog’
include Win32

syslog_dest = 13
syslog_port = 514
syslog_server = ‘192.168.123.122’

s = UDPSocket.new
EventLog.open(‘Application’).tail{ |log|
message = “WinEventLog
#{log.time_generated.asctime}||#{log.event_type}||#{log.source}||#{log.computer}||#{log.user}||#{log.description}”
s.send("<#{syslog_dest}>#{message}",0,syslog_server,syslog_port)
}

Regards,

Park H.