Forum: Ruby Re: syslog lib/module for remote logging

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Peña, Botp (Guest)
on 2006-06-02 04:50
(Received via mailing list)
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
Park H. (Guest)
on 2006-06-02 07:33
(Received via mailing list)
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.
This topic is locked and can not be replied to.