fluent-plugin-windows-eventlog 0.9.2 → 0.9.3
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 +4 -4
- data/.github/dependabot.yml +18 -1
- data/.github/workflows/unit-test.yml +12 -10
- data/CHANGELOG.md +4 -0
- data/fluent-plugin-winevtlog.gemspec +1 -1
- data/lib/fluent/plugin/in_windows_eventlog2.rb +17 -12
- data/test/plugin/test_in_windows_eventlog2.rb +171 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aee5a6fff0b05599c781dbb19b43ffd9487bb03a74ba69bbef1f0d20ff8eb0f1
|
|
4
|
+
data.tar.gz: e9176154815c7973a8ef90b4f5bf57f9be17ee5c8f1d5656d2247bc82b887b49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: accd4776c795d420558a6972199a05ac2ffe6e85851ed4c1b0fc4ece8d41e63c68f7be77805f9c606cb552799597c48ba45d3d16f7d4a03b583fb523afe67086
|
|
7
|
+
data.tar.gz: fed33969e72197fb43b6ca016c0d9cc98f993c767c757143f089f9605c3c311b1546aebb51dc8c4f22b28697333cb0cd1a9d758d233543a85d217afa536c1df7
|
data/.github/dependabot.yml
CHANGED
|
@@ -3,4 +3,21 @@ updates:
|
|
|
3
3
|
- package-ecosystem: 'github-actions'
|
|
4
4
|
directory: '/'
|
|
5
5
|
schedule:
|
|
6
|
-
interval: '
|
|
6
|
+
interval: 'monthly'
|
|
7
|
+
groups:
|
|
8
|
+
# PR: "Security update [package] from [old] to [new]"
|
|
9
|
+
# This PR should be merged in hurry
|
|
10
|
+
security-updates:
|
|
11
|
+
applies-to: security-updates
|
|
12
|
+
patterns:
|
|
13
|
+
- '*'
|
|
14
|
+
|
|
15
|
+
# PR: "Bump [package] from [old] to [new]"
|
|
16
|
+
# No need to be merged this PR in hurry. It is enough to merge
|
|
17
|
+
# once in a month.
|
|
18
|
+
monthly-updates:
|
|
19
|
+
applies-to: version-updates
|
|
20
|
+
patterns:
|
|
21
|
+
- '*'
|
|
22
|
+
# Allow to create PR both of security and normal updates.
|
|
23
|
+
open-pull-requests-limit: 1
|
|
@@ -4,32 +4,34 @@ on:
|
|
|
4
4
|
branches: [master]
|
|
5
5
|
pull_request:
|
|
6
6
|
branches: [master]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
7
9
|
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.7
|
|
8
15
|
test:
|
|
16
|
+
needs: ruby-versions
|
|
9
17
|
runs-on: ${{ matrix.os }}
|
|
10
|
-
continue-on-error: ${{ matrix.
|
|
18
|
+
continue-on-error: ${{ matrix.ruby == 'head' }}
|
|
11
19
|
strategy:
|
|
12
20
|
fail-fast: false
|
|
13
21
|
matrix:
|
|
14
|
-
ruby:
|
|
22
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
15
23
|
os:
|
|
16
24
|
- windows-latest
|
|
17
|
-
experimental: [false]
|
|
18
|
-
include:
|
|
19
|
-
- ruby: 'head'
|
|
20
|
-
os: windows-latest
|
|
21
|
-
experimental: true
|
|
22
25
|
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
|
|
23
26
|
steps:
|
|
24
|
-
- uses: actions/checkout@
|
|
25
|
-
- uses: ruby/setup-ruby@v1
|
|
27
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
|
+
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
26
29
|
with:
|
|
27
30
|
ruby-version: ${{ matrix.ruby }}
|
|
28
31
|
- name: Install
|
|
29
32
|
run: |
|
|
30
33
|
ruby --version
|
|
31
34
|
gem --version
|
|
32
|
-
gem install bundler rake
|
|
33
35
|
ridk exec bundle install --jobs 4 --retry 3
|
|
34
36
|
- name: Unit Test
|
|
35
37
|
run: |
|
data/CHANGELOG.md
CHANGED
|
@@ -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.9.
|
|
7
|
+
spec.version = "0.9.3"
|
|
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.}
|
|
@@ -39,6 +39,7 @@ module Fluent::Plugin
|
|
|
39
39
|
"Version" => ["Version", :string],
|
|
40
40
|
"Description" => ["Description", :string],
|
|
41
41
|
"EventData" => ["EventData", :array]}
|
|
42
|
+
RESERVED_RECORD_KEYS = (KEY_MAP.keys + ["DescriptionTitle"]).freeze
|
|
42
43
|
|
|
43
44
|
config_param :tag, :string
|
|
44
45
|
config_param :read_interval, :time, default: 2
|
|
@@ -412,30 +413,34 @@ module Fluent::Plugin
|
|
|
412
413
|
parent_key = nil
|
|
413
414
|
elem.split(RECORD_DELIMITER).each { |r|
|
|
414
415
|
key, value = if r.index(FIELD_DELIMITER)
|
|
415
|
-
r.split(FIELD_DELIMITER)
|
|
416
|
+
r.split(FIELD_DELIMITER, -1)
|
|
416
417
|
else
|
|
417
|
-
r.split(NONE_FIELD_DELIMITER)
|
|
418
|
+
r.split(NONE_FIELD_DELIMITER, -1)
|
|
418
419
|
end
|
|
419
|
-
key = "" if key.nil?
|
|
420
|
-
key.sub!(/:\s
|
|
420
|
+
key = +"" if key.nil?
|
|
421
|
+
key.sub!(/:\s*\z/, '') # remove ':' from key
|
|
422
|
+
k = parent_key.nil? ? to_key(key) : "#{parent_key}#{@description_key_delimiter}#{to_key(key)}"
|
|
423
|
+
taken = record.key?(k) || RESERVED_RECORD_KEYS.include?(k)
|
|
421
424
|
if value.nil?
|
|
422
|
-
|
|
425
|
+
unless key.empty?
|
|
426
|
+
previous_key = taken ? nil : k
|
|
427
|
+
parent_key = to_key(key)
|
|
428
|
+
end
|
|
423
429
|
else
|
|
424
430
|
# parsed value sometimes contain unexpected "\t". So remove it.
|
|
425
431
|
value.strip!
|
|
426
432
|
# merge empty key values into the previous non-empty key record.
|
|
433
|
+
# XXX: This is for empty privileges record key.
|
|
434
|
+
# We should investigate whether an another case exists or not.
|
|
427
435
|
if key.empty?
|
|
428
|
-
record[previous_key] = [record[previous_key], value].flatten.reject {|e| e.nil?}
|
|
429
|
-
elsif
|
|
430
|
-
|
|
436
|
+
record[previous_key] = [record[previous_key], value].flatten.reject {|e| e.nil?} if previous_key
|
|
437
|
+
elsif taken
|
|
438
|
+
previous_key = nil
|
|
431
439
|
else
|
|
432
|
-
k = "#{parent_key}#{@description_key_delimiter}#{to_key(key)}"
|
|
433
440
|
record[k] = value
|
|
441
|
+
previous_key = k
|
|
434
442
|
end
|
|
435
443
|
end
|
|
436
|
-
# XXX: This is for empty privileges record key.
|
|
437
|
-
# We should investigate whether an another case exists or not.
|
|
438
|
-
previous_key = to_key(key) unless key.empty?
|
|
439
444
|
}
|
|
440
445
|
}
|
|
441
446
|
end
|
|
@@ -268,6 +268,177 @@ DESC
|
|
|
268
268
|
assert_equal(expected, h)
|
|
269
269
|
end
|
|
270
270
|
|
|
271
|
+
def test_parse_desc_keeps_event_metadata
|
|
272
|
+
d = create_driver(config_element("ROOT", "", {"tag" => "fluent.eventlog",
|
|
273
|
+
"parse_description" => true,
|
|
274
|
+
"downcase_description_keys" => false
|
|
275
|
+
}, [
|
|
276
|
+
config_element("storage", "", {
|
|
277
|
+
'@type' => 'local',
|
|
278
|
+
'persistent' => false
|
|
279
|
+
}),
|
|
280
|
+
]))
|
|
281
|
+
desc = [
|
|
282
|
+
"Creating Scriptblock text (1 of 1):",
|
|
283
|
+
"",
|
|
284
|
+
"Channel:\t\tSecurity",
|
|
285
|
+
"\tEventID:\t\t4624",
|
|
286
|
+
"\tComputer:\t\tDC01",
|
|
287
|
+
].join("\r\n")
|
|
288
|
+
h = {"Channel" => "Microsoft-Windows-PowerShell/Operational",
|
|
289
|
+
"EventID" => "4104",
|
|
290
|
+
"Computer" => "DESKTOP-FLUENTTEST",
|
|
291
|
+
"Description" => desc}
|
|
292
|
+
expected = {"Channel" => "Microsoft-Windows-PowerShell/Operational",
|
|
293
|
+
"EventID" => "4104",
|
|
294
|
+
"Computer" => "DESKTOP-FLUENTTEST",
|
|
295
|
+
"DescriptionTitle" => "Creating Scriptblock text (1 of 1):"}
|
|
296
|
+
d.instance.parse_desc(h)
|
|
297
|
+
assert_equal(expected, h)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def test_parse_desc_keeps_the_first_value_of_a_duplicated_key
|
|
301
|
+
d = create_driver
|
|
302
|
+
desc = [
|
|
303
|
+
"Special privileges assigned to new logon.",
|
|
304
|
+
"",
|
|
305
|
+
"Subject:",
|
|
306
|
+
"\tAccount Name:\t\tAdministrator",
|
|
307
|
+
"",
|
|
308
|
+
"Subject:",
|
|
309
|
+
"\tAccount Name:\t\tSYSTEM",
|
|
310
|
+
].join("\r\n")
|
|
311
|
+
h = {"Description" => desc}
|
|
312
|
+
expected = {"DescriptionTitle" => "Special privileges assigned to new logon.",
|
|
313
|
+
"subject.account_name" => "Administrator"}
|
|
314
|
+
d.instance.parse_desc(h)
|
|
315
|
+
assert_equal(expected, h)
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
def test_parse_desc_does_not_merge_a_continuation_line_into_a_refused_key
|
|
319
|
+
d = create_driver
|
|
320
|
+
desc = [
|
|
321
|
+
"Special privileges assigned to new logon.",
|
|
322
|
+
"",
|
|
323
|
+
"Privileges:\t\tSeTcbPrivilege",
|
|
324
|
+
"",
|
|
325
|
+
"Privileges:\t\tSeDebugPrivilege",
|
|
326
|
+
"\t\tSeBackupPrivilege",
|
|
327
|
+
].join("\r\n")
|
|
328
|
+
h = {"Description" => desc}
|
|
329
|
+
expected = {"DescriptionTitle" => "Special privileges assigned to new logon.",
|
|
330
|
+
"privileges" => "SeTcbPrivilege"}
|
|
331
|
+
d.instance.parse_desc(h)
|
|
332
|
+
assert_equal(expected, h)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def test_parse_desc_does_not_merge_a_continuation_line_into_an_existing_key
|
|
336
|
+
d = create_driver
|
|
337
|
+
desc = [
|
|
338
|
+
"Special privileges assigned to new logon.",
|
|
339
|
+
"",
|
|
340
|
+
"Privileges:\t\tSeTcbPrivilege",
|
|
341
|
+
"",
|
|
342
|
+
"Privileges:",
|
|
343
|
+
"\t\tSeDebugPrivilege",
|
|
344
|
+
].join("\r\n")
|
|
345
|
+
h = {"Description" => desc}
|
|
346
|
+
expected = {"DescriptionTitle" => "Special privileges assigned to new logon.",
|
|
347
|
+
"privileges" => "SeTcbPrivilege"}
|
|
348
|
+
d.instance.parse_desc(h)
|
|
349
|
+
assert_equal(expected, h)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def test_parse_desc_keeps_event_metadata_reached_through_a_continuation_line
|
|
353
|
+
d = create_driver(config_element("ROOT", "", {"tag" => "fluent.eventlog",
|
|
354
|
+
"parse_description" => true,
|
|
355
|
+
"downcase_description_keys" => false
|
|
356
|
+
}, [
|
|
357
|
+
config_element("storage", "", {
|
|
358
|
+
'@type' => 'local',
|
|
359
|
+
'persistent' => false
|
|
360
|
+
}),
|
|
361
|
+
]))
|
|
362
|
+
desc = [
|
|
363
|
+
"Creating Scriptblock text (1 of 1):",
|
|
364
|
+
"",
|
|
365
|
+
"Channel:",
|
|
366
|
+
"\t\t\tspoofed",
|
|
367
|
+
].join("\r\n")
|
|
368
|
+
h = {"Channel" => "Microsoft-Windows-PowerShell/Operational",
|
|
369
|
+
"Description" => desc}
|
|
370
|
+
expected = {"Channel" => "Microsoft-Windows-PowerShell/Operational",
|
|
371
|
+
"DescriptionTitle" => "Creating Scriptblock text (1 of 1):"}
|
|
372
|
+
d.instance.parse_desc(h)
|
|
373
|
+
assert_equal(expected, h)
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
def test_parse_desc_with_empty_field_value
|
|
377
|
+
d = create_driver
|
|
378
|
+
desc = [
|
|
379
|
+
"A service was installed in the system.",
|
|
380
|
+
"",
|
|
381
|
+
"Subject:",
|
|
382
|
+
"\tAccount Domain:\t\t",
|
|
383
|
+
"\tLogon ID:\t\t0x3E7",
|
|
384
|
+
].join("\r\n")
|
|
385
|
+
h = {"Description" => desc}
|
|
386
|
+
expected = {"DescriptionTitle" => "A service was installed in the system.",
|
|
387
|
+
"subject.account_domain" => "",
|
|
388
|
+
"subject.logon_id" => "0x3E7"}
|
|
389
|
+
d.instance.parse_desc(h)
|
|
390
|
+
assert_equal(expected, h)
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
def test_parse_desc_with_an_empty_record_in_a_group
|
|
394
|
+
d = create_driver
|
|
395
|
+
desc = [
|
|
396
|
+
"A service was installed in the system.",
|
|
397
|
+
"",
|
|
398
|
+
"Subject:",
|
|
399
|
+
"\t",
|
|
400
|
+
"\tLogon ID:\t\t0x3E7",
|
|
401
|
+
].join("\r\n")
|
|
402
|
+
h = {"Description" => desc}
|
|
403
|
+
expected = {"DescriptionTitle" => "A service was installed in the system.",
|
|
404
|
+
"subject.logon_id" => "0x3E7"}
|
|
405
|
+
d.instance.parse_desc(h)
|
|
406
|
+
assert_equal(expected, h)
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
def test_parse_desc_with_empty_field_value_after_a_single_tab
|
|
410
|
+
d = create_driver
|
|
411
|
+
desc = [
|
|
412
|
+
"A service was installed in the system.",
|
|
413
|
+
"",
|
|
414
|
+
"Subject:",
|
|
415
|
+
"\tService File Name:\t",
|
|
416
|
+
"\tLogon ID:\t\t0x3E7",
|
|
417
|
+
].join("\r\n")
|
|
418
|
+
h = {"Description" => desc}
|
|
419
|
+
expected = {"DescriptionTitle" => "A service was installed in the system.",
|
|
420
|
+
"subject.service_file_name" => "",
|
|
421
|
+
"subject.logon_id" => "0x3E7"}
|
|
422
|
+
d.instance.parse_desc(h)
|
|
423
|
+
assert_equal(expected, h)
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
def test_parse_desc_merges_a_continuation_line_into_the_nested_key
|
|
427
|
+
d = create_driver
|
|
428
|
+
desc = [
|
|
429
|
+
"Special privileges assigned to new logon.",
|
|
430
|
+
"",
|
|
431
|
+
"Subject:",
|
|
432
|
+
"\tAccount Name:\t\tAdministrator",
|
|
433
|
+
"\t\tsecond-value",
|
|
434
|
+
].join("\r\n")
|
|
435
|
+
h = {"Description" => desc}
|
|
436
|
+
expected = {"DescriptionTitle" => "Special privileges assigned to new logon.",
|
|
437
|
+
"subject.account_name" => ["Administrator", "second-value"]}
|
|
438
|
+
d.instance.parse_desc(h)
|
|
439
|
+
assert_equal(expected, h)
|
|
440
|
+
end
|
|
441
|
+
|
|
271
442
|
def test_parse_privileges_description
|
|
272
443
|
d = create_driver
|
|
273
444
|
desc = ["Special privileges assigned to new logon.\r\n\r\nSubject:\r\n\tSecurity ID:\t\tS-X-Y-ZZ\r\n\t",
|
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.9.
|
|
4
|
+
version: 0.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- okahashi117
|
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
176
176
|
- !ruby/object:Gem::Version
|
|
177
177
|
version: '0'
|
|
178
178
|
requirements: []
|
|
179
|
-
rubygems_version:
|
|
179
|
+
rubygems_version: 4.0.18
|
|
180
180
|
specification_version: 4
|
|
181
181
|
summary: Fluentd Input plugin to read windows event log.
|
|
182
182
|
test_files:
|