# How can I send logstash logs to windows event?

**URL:** <https://discuss.elastic.co/t/how-can-i-send-logstash-logs-to-windows-event/125351>\
**Category:** Logstash\
**Created:** [March 23, 2018, 10:44am UTC](https://discuss.elastic.co/t/how-can-i-send-logstash-logs-to-windows-event/125351 "2018-03-23T10:44:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuf\_Karatoprak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yusuf_karatoprak/32/44539_2.png) [@Yusuf\_Karatoprak](https://discuss.elastic.co/u/Yusuf_Karatoprak)\
**Post date:** [March 23, 2018, 10:44am UTC](https://discuss.elastic.co/t/how-can-i-send-logstash-logs-to-windows-event/125351/1 "2018-03-23T10:44:15Z")

</div>

I am trying to add logstash logs to windows logs? I got an error, @jdno helped me to getrid of error.

Other question :

> <https://stackoverflow.com/questions/49404015/how-to-add-a-ruby-code-inside-of-the-logstash-config-file/49404686#49404686>

On the other hand; I want to write logs to windows event logs by using win32/eventlog.([https://github.com/chef/win32-eventlog](https://github.com/chef/win32-eventlog)) Error: **Ruby exception occurred: uninitialized constant Win32::EventLog::INFO.**

How can I solve this? My logstash.conf file :

```

    
input {
  file {
    type => "json"
    path => ["C:/Temp/logs/*.json"]
    start_position => "beginning"
    codec => "json"
    discover_interval => 120
	stat_interval => 60
	sincedb_write_interval => 60
	close_older => 60
  }
}
filter {
mutate {
    remove_field => ["path"] 

}
 ruby {
    code => "
	  require 'win32/eventlog'
      logger = Win32::EventLog.new
      logger.report_event(:event_type => Win32::EventLog::INFO, :data => 'a test event log entry')
     "
}

}
output {
    stdout {
        codec => rubydebug
    }

	elasticsearch {
       hosts => ["http://loguser:xxxxx_2017@192.169.5.84:333"]
	   index => "logstash-%{+YYYY.MM}"
    }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 20, 2018, 10:44am UTC](https://discuss.elastic.co/t/how-can-i-send-logstash-logs-to-windows-event/125351/2 "2018-04-20T10:44:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
