Forum: Ruby ruby eventlog monitor for windows

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.
6087a044557d6b59ab52e7dd20f94da8?d=identicon&s=25 Peña, Botp (Guest)
on 2006-04-25 11:37
(Received via mailing list)
Hi Win32 team,

I am looking for a ruby way/library to monitor windows event log.

Something like an event viewer yet very powerful,

require "win32/EventlogMonitor"

e = EventlogMonitor.monitor("localhost")
e.add_monitor "Application"    #monitor the Application event log

# monitor realtime
e.on_event do |event|
  if event.type =~ /warning/i and event.source =~ /msexchange/
     mail.sendmail user=>"botp" subject=>"ms exchange warnings"
  end
end


# read whole eventlog
e.open "Application"   # view the Application event log
e.read_line do |line|
   if line.type =~ /fail/ and line.source =~ /antivir/
      puts line
   end
end
e.close

I hope i am not asking too much.

thank you and kind regards -botp
This topic is locked and can not be replied to.