# Ruby eventlog monitor for windows

**URL:** <https://www.ruby-forum.com/t/ruby-eventlog-monitor-for-windows/94198>\
**Category:** Ruby\
**Created:** [April 25, 2006, 11:37am UTC](https://www.ruby-forum.com/t/ruby-eventlog-monitor-for-windows/94198 "2006-04-25T11:37:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 25, 2006, 11:37am UTC](https://www.ruby-forum.com/t/ruby-eventlog-monitor-for-windows/94198/1 "2006-04-25T11:37:13Z")

</div>

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
