winevt_c 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/eventlog.rb +1 -9
- data/example/tailing.rb +2 -6
- data/lib/winevt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ad0bd482eaac0eda25838c5a183d40a57cf99da30221e9c3eaaeb6a7b6f2f7
|
4
|
+
data.tar.gz: 1ff2674b2503c078501740d851765b07a8010cd20e6dcc4e18560424266b860d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e14a6ea1584be82c9e111f83387838043f54be435e6509cd36b8162c76b5ee2ab951b4b25676239462628edb167521980b00da480fb4b304cfa1da051abb347a
|
7
|
+
data.tar.gz: ce59efd377aec40a5b63fb56e7fe36673b58b73aa54bc887f798c45eb2aadce3ee744b4c934110ee9f31a516621746f9f3f22868681d173067a7f4fb253837b1
|
data/example/eventlog.rb
CHANGED
@@ -3,14 +3,6 @@ require 'rexml/document'
|
|
3
3
|
|
4
4
|
@query = Winevt::EventLog::Query.new("Application", "*[System[(Level <= 3) and TimeCreated[timediff(@SystemTime) <= 86400000]]]")
|
5
5
|
|
6
|
-
@query.each do |eventlog, message|
|
7
|
-
doc = REXML::Document.new(eventlog)
|
8
|
-
nodes = []
|
9
|
-
REXML::XPath.each(doc, "/Event/EventData/Data") do |node|
|
10
|
-
nodes << node.text
|
11
|
-
end
|
12
|
-
message = message.gsub(/(%\d+)/, '\1$s')
|
13
|
-
message = sprintf(message, *nodes)
|
14
|
-
|
6
|
+
@query.each do |eventlog, message, string_inserts|
|
15
7
|
puts ({eventlog: eventlog, data: message})
|
16
8
|
end
|
data/example/tailing.rb
CHANGED
@@ -8,13 +8,9 @@ while (1) do
|
|
8
8
|
if @subscribe.next
|
9
9
|
eventlog = @subscribe.render
|
10
10
|
message = @subscribe.message
|
11
|
-
|
12
|
-
nodes = []
|
13
|
-
REXML::XPath.each(doc, "/Event/EventData/Data") do |node|
|
14
|
-
nodes << node.text
|
15
|
-
end
|
11
|
+
string_inserts = @subscribe.string_inserts
|
16
12
|
message = message.gsub(/(%\d+)/, '\1$s')
|
17
|
-
message = sprintf(message, *
|
13
|
+
message = sprintf(message, *string_inserts)
|
18
14
|
|
19
15
|
puts ({eventlog: eventlog, data: message})
|
20
16
|
else
|
data/lib/winevt/version.rb
CHANGED