35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/fluent/plugin/parser_winevt_xml.rb', line 35
def parse(text)
record = {}
doc = Nokogiri::XML(text)
system_elem = doc/'Event'/'System'
record["ProviderName"] = (system_elem/"Provider").attribute("Name").text rescue nil
record["ProviderGUID"] = (system_elem/"Provider").attribute("Guid").text rescue nil
if @preserve_qualifiers
record["Qualifiers"] = (system_elem/'EventID').attribute("Qualifiers").text rescue nil
end
record["EventID"] = event_id(system_elem)
record["Level"] = (system_elem/'Level').text rescue nil
record["Task"] = (system_elem/'Task').text rescue nil
record["Opcode"] = (system_elem/'Opcode').text rescue nil
record["Keywords"] = (system_elem/'Keywords').text rescue nil
record["TimeCreated"] = (system_elem/'TimeCreated').attribute("SystemTime").text rescue nil
record["EventRecordID"] = (system_elem/'EventRecordID').text rescue nil
record["ActivityID"] = (system_elem/'Correlation').attribute('ActivityID').text rescue nil
record["RelatedActivityID"] = (system_elem/'Correlation').attribute("RelatedActivityID").text rescue nil
record["ThreadID"] = (system_elem/'Execution').attribute("ThreadID").text rescue nil
record["ProcessID"] = (system_elem/'Execution').attribute("ProcessID").text rescue nil
record["Channel"] = (system_elem/'Channel').text rescue nil
record["Computer"] = (system_elem/"Computer").text rescue nil
record["UserID"] = (system_elem/'Security').attribute("UserID").text rescue nil
record["Version"] = (system_elem/'Version').text rescue nil
time = @estimate_current_event ? Fluent::EventTime.now : nil
yield time, record
end
|