fluent-plugin-windows-eventlog 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -14
- data/appveyor.yml +9 -2
- data/fluent-plugin-winevtlog.gemspec +1 -1
- data/lib/fluent/plugin/in_windows_eventlog.rb +47 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31b8825e93acb7560e0faf0ccd8805c5536c4abe
|
4
|
+
data.tar.gz: '09d0929c2d91a475ea74b4f2cd5ec8691c2cd62c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6563ea82ba4b3ca319e04d477d58ba7e14ff171fccd3b01a74172ada116766f3fb8782c41e62b02c950e0ee1708a1e16579c6aa334a63b9eed70fede15a5c8be
|
7
|
+
data.tar.gz: 597d95a5fb7e09723bfd12a59c57863759b24764e3572b25835ec80c241245809a2db089b328d8ea957df53b7e9e99fa40420f2ebf76cae0bc95e8fbf11716e0
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Component
|
4
4
|
|
5
|
-
|
5
|
+
### fluentd Input plugin for the Windows Event Log
|
6
6
|
|
7
7
|
[Fluentd](http://fluentd.org) plugin to read the Windows Event Log.
|
8
8
|
|
@@ -10,7 +10,8 @@
|
|
10
10
|
gem install fluent-plugin-windows-eventlog
|
11
11
|
|
12
12
|
## Configuration
|
13
|
-
|
13
|
+
|
14
|
+
### fluentd Input plugin for the Windows Event Log
|
14
15
|
|
15
16
|
<source>
|
16
17
|
@type windows_eventlog
|
@@ -26,19 +27,21 @@
|
|
26
27
|
</storage>
|
27
28
|
</source>
|
28
29
|
|
29
|
-
|
30
|
+
### parameters
|
30
31
|
|
31
32
|
|name | description |
|
32
33
|
|:----- |:----- |
|
33
|
-
|`channels`
|
34
|
-
|`keys`
|
35
|
-
|`read_interval`
|
36
|
-
|`from_encoding`
|
37
|
-
|`encoding`
|
38
|
-
|`read_from_head
|
39
|
-
|`<storage>`
|
40
|
-
|
41
|
-
|
34
|
+
|`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.|
|
35
|
+
|`keys` | (option) A subset of [keys](#read-keys) to read. Defaults to all keys.|
|
36
|
+
|`read_interval` | (option) Read interval in seconds. 2 seconds as default.|
|
37
|
+
|`from_encoding` | (option) Input character encoding. `nil` as default.|
|
38
|
+
|`encoding` | (option) Output character encoding. `nil` as default.|
|
39
|
+
|`read_from_head` | (option) Start to read the entries from the oldest, not from when fluentd is started. Defaults to `false`.|
|
40
|
+
|`<storage>` | Setting for `storage` plugin for recording read position like `in_tail`'s `pos_file`.|
|
41
|
+
|`parse_description`| (option) parse `description` field and set parsed result into the record. `parse` and `string_inserts` fields are removed|
|
42
|
+
|
43
|
+
#### Available keys
|
44
|
+
|
42
45
|
This plugin reads the following fields from Windows Event Log entries. Use the `keys` configuration option to select a subset. No other customization is allowed for now.
|
43
46
|
|
44
47
|
|key|
|
@@ -55,9 +58,75 @@ This plugin reads the following fields from Windows Event Log entries. Use the `
|
|
55
58
|
|`description` |
|
56
59
|
|`string_inserts`|
|
57
60
|
|
61
|
+
#### `parse_description` details
|
62
|
+
|
63
|
+
Here is an example with `parse_description true`.
|
64
|
+
|
65
|
+
```
|
66
|
+
{
|
67
|
+
"channel": "security",
|
68
|
+
"record_number": "91698",
|
69
|
+
"time_generated": "2017-08-29 20:12:29 +0000",
|
70
|
+
"time_written": "2017-08-29 20:12:29 +0000",
|
71
|
+
"event_id": "4798",
|
72
|
+
"event_type": "audit_success",
|
73
|
+
"event_category": "13824",
|
74
|
+
"source_name": "Microsoft-Windows-Security-Auditing",
|
75
|
+
"computer_name": "TEST",
|
76
|
+
"user": "",
|
77
|
+
"description": "A user's local group membership was enumerated.\r\n\r\nSubject:\r\n\tSecurity ID:\t\tS-XXX\r\n\tAccount Name:\t\tTEST$\r\n\tAccount Domain:\t\tWORKGROUP\r\n\tLogon ID:\t\t0x3e7\r\n\r\nUser:\r\n\tSecurity ID:\t\tS-XXX-YYY-ZZZ\r\n\tAccount Name:\t\tAdministrator\r\n\tAccount Domain:\t\tTEST\r\n\r\nProcess Information:\r\n\tProcess ID:\t\t0x7dc\r\n\tProcess Name:\t\tC:\\Windows\\System32\\LogonUI.exe\r\n",
|
78
|
+
"string_inserts": [
|
79
|
+
"Administrator",
|
80
|
+
"TEST",
|
81
|
+
"S-XXX-YYY-ZZZ",
|
82
|
+
"S-XXX",
|
83
|
+
"TEST$",
|
84
|
+
"WORKGROUP",
|
85
|
+
"0x3e7",
|
86
|
+
"0x7dc",
|
87
|
+
"C:\\Windows\\System32\\LogonUI.exe"
|
88
|
+
]
|
89
|
+
}
|
90
|
+
```
|
91
|
+
|
92
|
+
This record is transformed to
|
93
|
+
|
94
|
+
```
|
95
|
+
{
|
96
|
+
"channel": "security",
|
97
|
+
"record_number": "91698",
|
98
|
+
"time_generated": "2017-08-29 20:12:29 +0000",
|
99
|
+
"time_written": "2017-08-29 20:12:29 +0000",
|
100
|
+
"event_id": "4798",
|
101
|
+
"event_type": "audit_success",
|
102
|
+
"event_category": "13824",
|
103
|
+
"source_name": "Microsoft-Windows-Security-Auditing",
|
104
|
+
"computer_name": "TEST",
|
105
|
+
"user": "",
|
106
|
+
"description_title": "A user's local group membership was enumerated.",
|
107
|
+
"subject.security_id": "S-XXX",
|
108
|
+
"subject.account_name": "TEST$",
|
109
|
+
"subject.account_domain": "WORKGROUP",
|
110
|
+
"subject.logon_id": "0x3e7",
|
111
|
+
"user.security_id": "S-XXX-YYY-ZZZ",
|
112
|
+
"user.account_name": "Administrator",
|
113
|
+
"user.account_domain": "TEST",
|
114
|
+
"process_information.process_id": "0x7dc",
|
115
|
+
"process_information.process_name": "C:\\Windows\\System32\\LogonUI.exe\r\n"
|
116
|
+
}
|
117
|
+
```
|
118
|
+
|
119
|
+
NOTE: This feature assumes `description` field has following formats:
|
120
|
+
|
121
|
+
- group delimiter: `\r\n\r\n`
|
122
|
+
- record delimiter: `\r\n\t`
|
123
|
+
- field delimiter: `\t\t`
|
124
|
+
|
125
|
+
If your `description` doesn't follow this format, the parsed result is only `description_title` field with same `description` content.
|
126
|
+
|
58
127
|
## Copyright
|
59
|
-
|
128
|
+
### Copyright
|
60
129
|
Copyright(C) 2014- @okahashi117
|
61
|
-
|
130
|
+
### License
|
62
131
|
Apache License, Version 2.0
|
63
132
|
|
data/appveyor.yml
CHANGED
@@ -5,10 +5,11 @@ version: '{build}'
|
|
5
5
|
|
6
6
|
install:
|
7
7
|
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
8
|
-
- "%devkit%\\devkitvars.bat"
|
8
|
+
- IF %ridk%==0 "%devkit%\\devkitvars.bat"
|
9
9
|
- ruby --version
|
10
10
|
- gem --version
|
11
|
-
- bundle install
|
11
|
+
- IF %ridk%==1 ridk.cmd exec bundle install
|
12
|
+
- IF %ridk%==0 bundle install
|
12
13
|
build: off
|
13
14
|
test_script:
|
14
15
|
- bundle exec rake test
|
@@ -23,5 +24,11 @@ environment:
|
|
23
24
|
matrix:
|
24
25
|
- ruby_version: "23-x64"
|
25
26
|
devkit: C:\Ruby23-x64\DevKit
|
27
|
+
ridk: 0
|
26
28
|
- ruby_version: "23"
|
27
29
|
devkit: C:\Ruby23\DevKit
|
30
|
+
ridk: 0
|
31
|
+
- ruby_version: "24-x64"
|
32
|
+
ridk: 1
|
33
|
+
- ruby_version: "24"
|
34
|
+
ridk: 1
|
@@ -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.2.
|
7
|
+
spec.version = "0.2.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.}
|
@@ -30,6 +30,8 @@ module Fluent::Plugin
|
|
30
30
|
config_param :read_from_head, :bool, default: false
|
31
31
|
config_param :from_encoding, :string, default: nil
|
32
32
|
config_param :encoding, :string, default: nil
|
33
|
+
desc "Parse 'description' field and set parsed result into event record. 'description' and 'string_inserts' fields are removed from the record"
|
34
|
+
config_param :parse_description, :bool, default: false
|
33
35
|
|
34
36
|
config_section :storage do
|
35
37
|
config_set_default :usage, "positions"
|
@@ -56,6 +58,8 @@ module Fluent::Plugin
|
|
56
58
|
if @keynames.empty?
|
57
59
|
@keynames = KEY_MAP.keys
|
58
60
|
end
|
61
|
+
@keynames.delete('string_inserts') if @parse_description
|
62
|
+
|
59
63
|
@tag = tag
|
60
64
|
@stop = false
|
61
65
|
configure_encoding
|
@@ -136,6 +140,7 @@ module Fluent::Plugin
|
|
136
140
|
raise "Unknown value type: #{type}"
|
137
141
|
end
|
138
142
|
end
|
143
|
+
parse_desc(h) if @parse_description
|
139
144
|
#h = Hash[@keynames.map {|k| [k, r.send(KEY_MAP[k][0]).to_s]}]
|
140
145
|
router.emit(@tag, Fluent::Engine.now, h)
|
141
146
|
end
|
@@ -183,5 +188,47 @@ module Fluent::Plugin
|
|
183
188
|
ensure
|
184
189
|
el.close
|
185
190
|
end
|
191
|
+
|
192
|
+
GROUP_DELIMITER = "\r\n\r\n".freeze
|
193
|
+
RECORD_DELIMITER = "\r\n\t".freeze
|
194
|
+
FIELD_DELIMITER = "\t\t".freeze
|
195
|
+
NONE_FIELD_DELIMITER = "\t".freeze
|
196
|
+
|
197
|
+
def parse_desc(record)
|
198
|
+
desc = record.delete('description'.freeze)
|
199
|
+
return if desc.nil?
|
200
|
+
|
201
|
+
elems = desc.split(GROUP_DELIMITER)
|
202
|
+
record['description_title'] = elems.shift
|
203
|
+
elems.each { |elem|
|
204
|
+
parent_key = nil
|
205
|
+
elem.split(RECORD_DELIMITER).each { |r|
|
206
|
+
key, value = if r.index(FIELD_DELIMITER)
|
207
|
+
r.split(FIELD_DELIMITER)
|
208
|
+
else
|
209
|
+
r.split(NONE_FIELD_DELIMITER)
|
210
|
+
end
|
211
|
+
key.chop! # remove ':' from key
|
212
|
+
if value.nil?
|
213
|
+
parent_key = to_key(key)
|
214
|
+
else
|
215
|
+
# parsed value sometimes contain unexpected "\t". So remove it.
|
216
|
+
value.strip!
|
217
|
+
if parent_key.nil?
|
218
|
+
record[to_key(key)] = value
|
219
|
+
else
|
220
|
+
k = "#{parent_key}.#{to_key(key)}"
|
221
|
+
record[k] = value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
}
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
def to_key(key)
|
229
|
+
key.downcase!
|
230
|
+
key.gsub!(' '.freeze, '_'.freeze)
|
231
|
+
key
|
232
|
+
end
|
186
233
|
end
|
187
234
|
end
|
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.2.
|
4
|
+
version: 0.2.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: 2017-
|
13
|
+
date: 2017-09-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|