fluent-plugin-windows-eventlog 0.4.4 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6634a0ee22c7988e40ebe92ebd457996eb25cfdd926a09c557e497065f6dbeac
4
- data.tar.gz: 8f3a1543db5dd4a2299c5675ccd81ee19e10b476b06e3f6b7685213e14247814
3
+ metadata.gz: 359baf1a9205ef362e4504df9408456929e11476b8b7ca8f31b930fa75f67996
4
+ data.tar.gz: 3022117b4b9650f09e7856cfbb82a39267818bb71b46fb016ca0f71deb26c4d9
5
5
  SHA512:
6
- metadata.gz: 8c9450771f970e88ec85ec5a44f3156a93475aeef12a729ffafe87c863516939fa66c739791b20c6e5bff30ba72e5958f14701b0713d5dca747c1b7919dee72c
7
- data.tar.gz: 4d44d036e961e7cd502932863eedeb3781f25507384737850f9a81eb70f4099b0d24d27f8cc0f7753d310f9c3702273fd914271efa398e102610a2084b90c06a
6
+ metadata.gz: c37d3b7a0a0c8b39e889efdda75fd7d22e6227b7a60eb1c47e9f2b459458c3144725a9d68f7e4ad6215315f62ce0829dde6730f7fccc4d37d93b2a47e7e8951f
7
+ data.tar.gz: b1cad59577bcec5188c0009545d0a89087210abf8b5bc1f946453607ab0b3f8b87aff1dfacbbf066d0d3b61c0505b9ffdde9da3ab788ca9dd2bc53be1ee65f1e
@@ -1,3 +1,19 @@
1
+ # Release v0.5.2 - 2020/02/28
2
+ * in_windows_eventlog2: Add parameter to read from all channels shortcut
3
+
4
+ # Release v0.5.1 - 2020/02/26
5
+ * in_windows_eventlog2: Add empty bookmark checking mechanism
6
+
7
+ # Release v0.5.0 - 2020/02/17
8
+ * in_windows_eventlog2: Support subscribe directive to handle read_existing_events paratemer each of channels.
9
+ * in_windows_eventlog2: Depends on winevt_c v0.7.0 or later.
10
+
11
+ # Release v0.4.6 - 2020/02/15
12
+ * Fix winevt_c dependency to prevent fetching winevt_c v0.7.0 or later.
13
+
14
+ # Release v0.4.5 - 2020/01/28
15
+ * in_windows_eventlog2: Handle empty key case in parsing description method.
16
+
1
17
  # Release v0.4.4 - 2019/11/07
2
18
  * in_windows_eventlog: Improve error handling and logging when failed to open Windows Event Log.
3
19
 
data/README.md CHANGED
@@ -135,7 +135,8 @@ fluentd Input plugin for the Windows Event Log using newer Windows Event Logging
135
135
  <source>
136
136
  @type windows_eventlog2
137
137
  @id windows_eventlog2
138
- channels application,system
138
+ channels application,system # Also be able to use `<subscribe>` directive.
139
+ read_existing_events false
139
140
  read_interval 2
140
141
  tag winevt.raw
141
142
  render_as_xml false # default is true.
@@ -149,6 +150,10 @@ fluentd Input plugin for the Windows Event Log using newer Windows Event Logging
149
150
  <parse>
150
151
  @type winevt_xml # @type winevt_xml is the default. winevt_xml and none parsers are supported for now.
151
152
  </parse>
153
+ # <subscribe>
154
+ # channles application, system
155
+ # read_existing_events false # read_existing_events should be applied each of subscribe directive(s)
156
+ # </subscribe>
152
157
  </source>
153
158
 
154
159
  **NOTE:** in_windows_eventlog2 always handles EventLog records as UTF-8 characters. Users don't have to specify encoding related parameters and they are not provided.
@@ -163,13 +168,60 @@ fluentd Input plugin for the Windows Event Log using newer Windows Event Logging
163
168
 
164
169
  |name | description |
165
170
  |:----- |:----- |
166
- |`channels` | (option) 'application' as default. One or more of {'application', 'system', 'setup', 'security'}. If you want to read 'setup' or 'security' logs, you must launch fluentd with administrator privileges.|
171
+ |`channels` | (option) No default value just empty array, but 'application' is used as default due to backward compatibility. One or more of {'application', 'system', 'setup', 'security'}. If you want to read 'setup' or 'security' logs, you must launch fluentd with administrator privileges.|
167
172
  |`keys` | (option) A subset of [keys](#read-keys) to read. Defaults to all keys.|
168
173
  |`read_interval` | (option) Read interval in seconds. 2 seconds as default.|
169
174
  |`from_encoding` | (option) Input character encoding. `nil` as default.|
170
175
  |`<storage>` | Setting for `storage` plugin for recording read position like `in_tail`'s `pos_file`.|
171
176
  |`<parse>` | Setting for `parser` plugin for parsing raw XML EventLog records. |
172
177
  |`parse_description`| (option) parse `description` field and set parsed result into the record. `Description` and `EventData` fields are removed|
178
+ |`read_from_head` | **Deprecated** (option) Start to read the entries from the oldest, not from when fluentd is started. Defaults to `false`.|
179
+ |`read_existing_events` | (option) Read the entries which already exist before fluentd is started. Defaults to `false`.|
180
+ |`rate_limit` | (option) Specify rate limit to consume EventLog. Default is `Winevt::EventLog::Subscribe::RATE_INFINITE`.|
181
+ |`read_all_channels`| (option) Read from all channels. Default is `false`|
182
+ |`<subscribe>` | Setting for subscribe channels. |
183
+
184
+ ##### subscribe section
185
+
186
+ |name | description |
187
+ |:----- |:----- |
188
+ |`channels` | One or more of {'application', 'system', 'setup', 'security'}. If you want to read 'setup' or 'security' logs, you must launch fluentd with administrator privileges. |
189
+ |`read_existing_events` | (option) Read the entries which already exist before fluentd is started. Defaults to `false`. |
190
+
191
+
192
+ **Motivation:** subscribe directive is designed for applying `read_existing_events` each of channels which is specified in subscribe section(s).
193
+
194
+ e.g) The previous configuration can handle `read_existing_events` but this parameter only specifies `read_existing_events` or not for channels which are specified in `channels`.
195
+
196
+ ```aconf
197
+ channels ["Application", "Security", "HardwareEvents"]
198
+ read_existing_events true
199
+ ```
200
+
201
+ is interpreted as "Application", "Security", and "HardwareEvents" should be read existing events.
202
+
203
+ But some users want to configure to:
204
+
205
+ * "Application" and "Security" channels just tailing
206
+ * "HardwareEvent" channel read existing events before launching Fluentd
207
+
208
+ With `<subscribe>` directive, this requirements can be represendted as:
209
+
210
+ ```aconf
211
+ <subscribe>
212
+ channles ["Application", "Security"]
213
+ # read_existing_events false
214
+ </subscribe>
215
+ <subscribe>
216
+ channles ["HardwareEvent"]
217
+ read_existing_events true
218
+ </subscribe>
219
+ ```
220
+
221
+ This configuration can be handled as:
222
+
223
+ * "Application" and "Security" channels just tailing
224
+ * "HardwareEvent" channel read existing events before launching Fluentd
173
225
 
174
226
  ##### Available keys
175
227
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-windows-eventlog"
7
- spec.version = "0.4.4"
7
+ spec.version = "0.5.2"
8
8
  spec.authors = ["okahashi117", "Hiroshi Hatake", "Masahiro Nakagawa"]
9
9
  spec.email = ["naruki_okahashi@jbat.co.jp", "cosmo0920.oucc@gmail.com", "repeatedly@gmail.com"]
10
10
  spec.summary = %q{Fluentd Input plugin to read windows event log.}
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "test-unit", "~> 3.2.0"
23
23
  spec.add_runtime_dependency "fluentd", [">= 0.14.12", "< 2"]
24
24
  spec.add_runtime_dependency "win32-eventlog"
25
- spec.add_runtime_dependency "winevt_c", ">= 0.6.1"
25
+ spec.add_runtime_dependency "winevt_c", ">= 0.7.1"
26
26
  spec.add_runtime_dependency "nokogiri", "~> 1.10"
27
27
  spec.add_runtime_dependency "fluent-plugin-parser-winevt_xml", ">= 0.1.2"
28
28
  end
@@ -0,0 +1,30 @@
1
+ require 'nokogiri'
2
+
3
+ class WinevtBookmarkDocument < Nokogiri::XML::SAX::Document
4
+ attr_reader :result
5
+
6
+ def initialize
7
+ @result = {}
8
+ super
9
+ end
10
+
11
+ def start_document
12
+ end
13
+
14
+ def start_element(name, attributes = [])
15
+ if name == "Bookmark"
16
+ @result[:channel] = attributes[0][1] rescue nil
17
+ @result[:record_id] = attributes[1][1].to_i rescue nil
18
+ @result[:is_current] = attributes[2][1].downcase == "true" rescue nil
19
+ end
20
+ end
21
+
22
+ def characters(string)
23
+ end
24
+
25
+ def end_element(name, attributes = [])
26
+ end
27
+
28
+ def end_document
29
+ end
30
+ end
@@ -1,6 +1,7 @@
1
1
  require 'winevt'
2
2
  require 'fluent/plugin/input'
3
3
  require 'fluent/plugin'
4
+ require_relative 'bookmark_sax_parser'
4
5
 
5
6
  module Fluent::Plugin
6
7
  class WindowsEventLog2Input < Input
@@ -32,12 +33,19 @@ module Fluent::Plugin
32
33
 
33
34
  config_param :tag, :string
34
35
  config_param :read_interval, :time, default: 2
35
- config_param :channels, :array, default: ['application']
36
+ config_param :channels, :array, default: []
36
37
  config_param :keys, :array, default: []
37
- config_param :read_from_head, :bool, default: false
38
+ config_param :read_from_head, :bool, default: false, deprecated: "Use `read_existing_events' instead."
39
+ config_param :read_existing_events, :bool, default: false
38
40
  config_param :parse_description, :bool, default: false
39
41
  config_param :render_as_xml, :bool, default: true
40
42
  config_param :rate_limit, :integer, default: Winevt::EventLog::Subscribe::RATE_INFINITE
43
+ config_param :read_all_channels, :bool, default: false
44
+
45
+ config_section :subscribe, param_name: :subscribe_configs, required: false, multi: true do
46
+ config_param :channels, :array
47
+ config_param :read_existing_events, :bool, default: false
48
+ end
41
49
 
42
50
  config_section :storage do
43
51
  config_set_default :usage, "bookmarks"
@@ -58,7 +66,31 @@ module Fluent::Plugin
58
66
 
59
67
  def configure(conf)
60
68
  super
61
- @chs = @channels.map {|ch| ch.strip.downcase }.uniq
69
+ @chs = []
70
+ @all_chs = Winevt::EventLog::Channel.new
71
+ @all_chs.force_enumerate = false
72
+
73
+ if @read_all_channels
74
+ @all_chs.each do |ch|
75
+ uch = ch.strip.downcase
76
+ @chs.push([uch, @read_existing_events])
77
+ end
78
+ end
79
+
80
+ @read_existing_events = @read_from_head || @read_existing_events
81
+ if @channels.empty? && @subscribe_configs.empty? && !@read_all_channels
82
+ @chs.push(['application', @read_existing_events])
83
+ else
84
+ @channels.map {|ch| ch.strip.downcase }.uniq.each do |uch|
85
+ @chs.push([uch, @read_existing_events])
86
+ end
87
+ @subscribe_configs.each do |subscribe|
88
+ subscribe.channels.map {|ch| ch.strip.downcase }.uniq.each do |uch|
89
+ @chs.push([uch, subscribe.read_existing_events])
90
+ end
91
+ end
92
+ end
93
+ @chs.uniq!
62
94
  @keynames = @keys.map {|k| k.strip }.uniq
63
95
  if @keynames.empty?
64
96
  @keynames = KEY_MAP.keys
@@ -67,7 +99,6 @@ module Fluent::Plugin
67
99
  @keynames.delete('EventData') if @parse_description
68
100
 
69
101
  @tag = tag
70
- @tailing = @read_from_head ? false : true
71
102
  @bookmarks_storage = storage_create(usage: "bookmarks")
72
103
  @winevt_xml = false
73
104
  if @render_as_xml
@@ -86,30 +117,48 @@ module Fluent::Plugin
86
117
  def start
87
118
  super
88
119
 
89
- @chs.each do |ch|
90
- bookmarkXml = @bookmarks_storage.get(ch) || ""
91
- subscribe = Winevt::EventLog::Subscribe.new
92
- bookmark = unless bookmarkXml.empty?
93
- Winevt::EventLog::Bookmark.new(bookmarkXml)
94
- else
95
- nil
96
- end
97
- subscribe.tail = @tailing
98
- begin
99
- subscribe.subscribe(ch, "*", bookmark)
100
- rescue Winevt::EventLog::Query::Error => e
101
- raise Fluent::ConfigError, "Invalid Bookmark XML is loaded. #{e}"
102
- end
103
- subscribe.render_as_xml = @render_as_xml
104
- subscribe.rate_limit = @rate_limit
105
- timer_execute("in_windows_eventlog_#{escape_channel(ch)}".to_sym, @read_interval) do
106
- on_notify(ch, subscribe)
107
- end
120
+ @chs.each do |ch, read_existing_events|
121
+ subscribe_channel(ch, read_existing_events)
122
+ end
123
+ end
124
+
125
+ def subscribe_channel(ch, read_existing_events)
126
+ bookmarkXml = @bookmarks_storage.get(ch) || ""
127
+ bookmark = nil
128
+ if bookmark_validator(bookmarkXml, ch)
129
+ bookmark = Winevt::EventLog::Bookmark.new(bookmarkXml)
130
+ end
131
+ subscribe = Winevt::EventLog::Subscribe.new
132
+ subscribe.read_existing_events = read_existing_events
133
+ begin
134
+ subscribe.subscribe(ch, "*", bookmark)
135
+ rescue Winevt::EventLog::Query::Error => e
136
+ raise Fluent::ConfigError, "Invalid Bookmark XML is loaded. #{e}"
137
+ end
138
+ subscribe.render_as_xml = @render_as_xml
139
+ subscribe.rate_limit = @rate_limit
140
+ timer_execute("in_windows_eventlog_#{escape_channel(ch)}".to_sym, @read_interval) do
141
+ on_notify(ch, subscribe)
142
+ end
143
+ end
144
+
145
+ def bookmark_validator(bookmarkXml, channel)
146
+ return false if bookmarkXml.empty?
147
+
148
+ evtxml = WinevtBookmarkDocument.new
149
+ parser = Nokogiri::XML::SAX::Parser.new(evtxml)
150
+ parser.parse(bookmarkXml)
151
+ result = evtxml.result
152
+ if !result.empty? && (result[:channel].downcase == channel.downcase) && result[:is_current]
153
+ true
154
+ else
155
+ log.warn "This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe: #{bookmarkXml}, channel: #{channel}"
156
+ false
108
157
  end
109
158
  end
110
159
 
111
160
  def escape_channel(ch)
112
- ch.gsub(/[^a-zA-Z0-9]/, '_')
161
+ ch.gsub(/[^a-zA-Z0-9\s]/, '_')
113
162
  end
114
163
 
115
164
  def on_notify(ch, subscribe)
@@ -209,6 +258,7 @@ module Fluent::Plugin
209
258
  else
210
259
  r.split(NONE_FIELD_DELIMITER)
211
260
  end
261
+ key = "" if key.nil?
212
262
  key.chop! # remove ':' from key
213
263
  if value.nil?
214
264
  parent_key = to_key(key)
@@ -217,7 +267,7 @@ module Fluent::Plugin
217
267
  value.strip!
218
268
  # merge empty key values into the previous non-empty key record.
219
269
  if key.empty?
220
- record[previous_key] = [record[previous_key], value].flatten
270
+ record[previous_key] = [record[previous_key], value].flatten.reject {|e| e.nil?}
221
271
  elsif parent_key.nil?
222
272
  record[to_key(key)] = value
223
273
  else
@@ -0,0 +1,27 @@
1
+ A new external device was recognized by the system.
2
+
3
+ Subject:
4
+ Security ID: SYSTEM
5
+ Account Name: IIZHU2016$
6
+ Account Domain: ITSS
7
+ Logon ID: 0x3E7
8
+
9
+ Device ID: SWD\PRINTENUM\{60FA1C6A-1AB2-440A-AEE1-62ABFB9A4650}
10
+
11
+ Device Name: Microsoft Print to PDF
12
+
13
+ Class ID: {1ed2bbf9-11f0-4084-b21f-ad83a8e6dcdc}
14
+
15
+ Class Name: PrintQueue
16
+
17
+ Vendor IDs:
18
+ PRINTENUM\{084f01fa-e634-4d77-83ee-074817c03581}
19
+ PRINTENUM\LocalPrintQueue
20
+ {084f01fa-e634-4d77-83ee-074817c03581}
21
+
22
+
23
+
24
+ Compatible IDs:
25
+ GenPrintQueue
26
+ SWD\GenericRaw
27
+ SWD\Generic
@@ -25,6 +25,7 @@ end
25
25
  require 'fluent/test/driver/input'
26
26
  require 'fluent/plugin/in_windows_eventlog'
27
27
  require 'fluent/plugin/in_windows_eventlog2'
28
+ require 'fluent/plugin/bookmark_sax_parser'
28
29
 
29
30
  class Test::Unit::TestCase
30
31
  end
@@ -0,0 +1,41 @@
1
+ require_relative '../helper'
2
+
3
+ class BookmarkSAXParserTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @evtxml = WinevtBookmarkDocument.new
7
+ @parser = Nokogiri::XML::SAX::Parser.new(@evtxml)
8
+ end
9
+
10
+ def test_parse
11
+ bookmark_str = <<EOS
12
+ <BookmarkList>
13
+ <Bookmark Channel='Application' RecordId='161332' IsCurrent='true'/>
14
+ </BookmarkList>
15
+ EOS
16
+ @parser.parse(bookmark_str)
17
+ expected = {channel: "Application", record_id: 161332, is_current: true}
18
+ assert_equal expected, @evtxml.result
19
+ end
20
+
21
+ def test_parse_2
22
+ bookmark_str = <<EOS
23
+ <BookmarkList>
24
+ <Bookmark Channel='Security' RecordId='25464' IsCurrent='true'/>
25
+ </BookmarkList>
26
+ EOS
27
+ @parser.parse(bookmark_str)
28
+ expected = {channel: "Security", record_id: 25464, is_current: true}
29
+ assert_equal expected, @evtxml.result
30
+ end
31
+
32
+ def test_parse_empty_bookmark_list
33
+ bookmark_str = <<EOS
34
+ <BookmarkList>
35
+ </BookmarkList>
36
+ EOS
37
+ @parser.parse(bookmark_str)
38
+ expected = {}
39
+ assert_equal expected, @evtxml.result
40
+ end
41
+ end
@@ -23,11 +23,84 @@ class WindowsEventLog2InputTest < Test::Unit::TestCase
23
23
  d = create_driver CONFIG
24
24
  assert_equal 'fluent.eventlog', d.instance.tag
25
25
  assert_equal 2, d.instance.read_interval
26
- assert_equal ['application'], d.instance.channels
27
- assert_false d.instance.read_from_head
26
+ assert_equal [], d.instance.channels
27
+ assert_false d.instance.read_existing_events
28
28
  assert_true d.instance.render_as_xml
29
29
  end
30
30
 
31
+ sub_test_case "configure" do
32
+ test "subscribe directive" do
33
+ d = create_driver config_element("ROOT", "", {"tag" => "fluent.eventlog"}, [
34
+ config_element("storage", "", {
35
+ '@type' => 'local',
36
+ 'persistent' => false
37
+ }),
38
+ config_element("subscribe", "", {
39
+ 'channels' => ['System', 'Windows PowerShell'],
40
+ }),
41
+ config_element("subscribe", "", {
42
+ 'channels' => ['Security'],
43
+ 'read_existing_events' => true
44
+ }),
45
+ ])
46
+ expected = [["system", false], ["windows powershell", false], ["security", true]]
47
+ assert_equal expected, d.instance.instance_variable_get(:@chs)
48
+ end
49
+
50
+ test "duplicated subscribe" do
51
+ d = create_driver config_element("ROOT", "", {"tag" => "fluent.eventlog",
52
+ "channels" => ["System", "Windows PowerShell"]
53
+ }, [
54
+ config_element("storage", "", {
55
+ '@type' => 'local',
56
+ 'persistent' => false
57
+ }),
58
+ config_element("subscribe", "", {
59
+ 'channels' => ['System', 'Windows PowerShell'],
60
+ }),
61
+ config_element("subscribe", "", {
62
+ 'channels' => ['Security'],
63
+ 'read_existing_events' => true
64
+ }),
65
+ ])
66
+ expected = [["system", false], ["windows powershell", false], ["security", true]]
67
+ assert_equal 1, d.instance.instance_variable_get(:@chs).select {|ch, flag| ch == "system"}.size
68
+ assert_equal expected, d.instance.instance_variable_get(:@chs)
69
+ end
70
+
71
+ test "non duplicated subscribe" do
72
+ d = create_driver config_element("ROOT", "", {"tag" => "fluent.eventlog",
73
+ "channels" => ["System", "Windows PowerShell"]
74
+ }, [
75
+ config_element("storage", "", {
76
+ '@type' => 'local',
77
+ 'persistent' => false
78
+ }),
79
+ config_element("subscribe", "", {
80
+ 'channels' => ['System', 'Windows PowerShell'],
81
+ 'read_existing_events' => true
82
+ }),
83
+ config_element("subscribe", "", {
84
+ 'channels' => ['Security'],
85
+ 'read_existing_events' => true
86
+ }),
87
+ ])
88
+ expected = [["system", false], ["windows powershell", false], ["system", true], ["windows powershell", true], ["security", true]]
89
+ assert_equal 2, d.instance.instance_variable_get(:@chs).select {|ch, flag| ch == "system"}.size
90
+ assert_equal expected, d.instance.instance_variable_get(:@chs)
91
+ end
92
+ end
93
+
94
+ data("application" => ["Application", "Application"],
95
+ "windows powershell" => ["Windows PowerShell", "Windows PowerShell"],
96
+ "escaped" => ["Should_Be_Escaped_", "Should+Be;Escaped/"]
97
+ )
98
+ def test_escape_channel(data)
99
+ expected, actual = data
100
+ d = create_driver CONFIG
101
+ assert_equal expected, d.instance.escape_channel(actual)
102
+ end
103
+
31
104
  def test_parse_desc
32
105
  d = create_driver
33
106
  desc =<<-DESC
@@ -80,6 +153,31 @@ DESC
80
153
  assert_equal(expected, h)
81
154
  end
82
155
 
156
+ test "A new external device was recognized by the system." do
157
+ # using the event log example: eventopedia.cloudapp.net/EventDetails.aspx?id=17ef124e-eb89-4c01-9ba2-d761e06b2b68
158
+ d = create_driver
159
+ desc = nil
160
+ File.open('./test/data/eventid_6416', 'r') do |f|
161
+ desc = f.read.gsub(/\R/, "\r\n")
162
+ end
163
+ h = {"Description" => desc}
164
+ expected = {"DescriptionTitle" => "A new external device was recognized by the system.",
165
+ "class_id" => "{1ed2bbf9-11f0-4084-b21f-ad83a8e6dcdc}",
166
+ "class_name" => "PrintQueue",
167
+ "compatible_ids" => ["GenPrintQueue", "SWD\\GenericRaw", "SWD\\Generic"],
168
+ "device_id" => "SWD\\PRINTENUM\\{60FA1C6A-1AB2-440A-AEE1-62ABFB9A4650}",
169
+ "device_name" => "Microsoft Print to PDF",
170
+ "subject.account_domain" => "ITSS",
171
+ "subject.account_name" => "IIZHU2016$",
172
+ "subject.logon_id" => "0x3E7",
173
+ "subject.security_id" => "SYSTEM",
174
+ "vendor_ids" => ["PRINTENUM\\{084f01fa-e634-4d77-83ee-074817c03581}",
175
+ "PRINTENUM\\LocalPrintQueue",
176
+ "{084f01fa-e634-4d77-83ee-074817c03581}"]}
177
+ d.instance.parse_desc(h)
178
+ assert_equal(expected, h)
179
+ end
180
+
83
181
  def test_write
84
182
  d = create_driver
85
183
 
@@ -163,6 +261,7 @@ DESC
163
261
  config_element("storage", "", {
164
262
  '@type' => 'local',
165
263
  '@id' => 'test-02',
264
+ '@log_level' => "info",
166
265
  'path' => File.join(TEST_PLUGIN_STORAGE_PATH,
167
266
  'json', 'test-02.json'),
168
267
  'persistent' => true,
@@ -226,6 +325,21 @@ EOS
226
325
  assert_raise(Fluent::ConfigError) do
227
326
  d2.instance.start
228
327
  end
328
+ assert_equal 0, d2.logs.grep(/This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe:/).length
329
+ end
330
+
331
+ def test_start_with_empty_bookmark
332
+ invalid_storage_contents = <<-EOS
333
+ <BookmarkList>\r\n</BookmarkList>
334
+ EOS
335
+ d = create_driver(CONFIG2)
336
+ storage = d.instance.instance_variable_get(:@bookmarks_storage)
337
+ storage.put('application', invalid_storage_contents)
338
+ assert File.exist?(File.join(TEST_PLUGIN_STORAGE_PATH, 'json', 'test-02.json'))
339
+
340
+ d2 = create_driver(CONFIG2)
341
+ d2.instance.start
342
+ assert_equal 1, d2.logs.grep(/This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe:/).length
229
343
  end
230
344
  end
231
345
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-windows-eventlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - okahashi117
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-11-07 00:00:00.000000000 Z
13
+ date: 2020-02-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -94,14 +94,14 @@ dependencies:
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 0.6.1
97
+ version: 0.7.1
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 0.6.1
104
+ version: 0.7.1
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: nokogiri
107
107
  requirement: !ruby/object:Gem::Requirement
@@ -147,10 +147,13 @@ files:
147
147
  - Rakefile
148
148
  - appveyor.yml
149
149
  - fluent-plugin-winevtlog.gemspec
150
+ - lib/fluent/plugin/bookmark_sax_parser.rb
150
151
  - lib/fluent/plugin/in_windows_eventlog.rb
151
152
  - lib/fluent/plugin/in_windows_eventlog2.rb
153
+ - test/data/eventid_6416
152
154
  - test/generate-windows-event.rb
153
155
  - test/helper.rb
156
+ - test/plugin/test_bookmark_sax_parser.rb
154
157
  - test/plugin/test_in_windows_eventlog2.rb
155
158
  - test/plugin/test_in_winevtlog.rb
156
159
  homepage: https://github.com/fluent/fluent-plugin-windows-eventlog
@@ -173,12 +176,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
176
  version: '0'
174
177
  requirements: []
175
178
  rubyforge_project:
176
- rubygems_version: 2.7.3
179
+ rubygems_version: 2.7.6.2
177
180
  signing_key:
178
181
  specification_version: 4
179
182
  summary: Fluentd Input plugin to read windows event log.
180
183
  test_files:
184
+ - test/data/eventid_6416
181
185
  - test/generate-windows-event.rb
182
186
  - test/helper.rb
187
+ - test/plugin/test_bookmark_sax_parser.rb
183
188
  - test/plugin/test_in_windows_eventlog2.rb
184
189
  - test/plugin/test_in_winevtlog.rb