Post
by CameronWP » Thu Feb 08, 2018 9:24 am
Hi all:
Here is the finished version I came up with that is parsing things reasonably well:
if [type] == 'mcafee' {
mutate {
gsub => [
'message', '^<.*\?>', ''
]
}
if [message] =~ /^<EE_Event>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "EE_Event/MachineInfo", "HostDetails" ]
xpath => [ "EE_Event/EventData", "EventDetails" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
}
if [message] =~ /^<DLPAGENT9400>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "DLPAGENT9400/MachineInfo", "HostDetails" ]
xpath => [ "DLPAGENT9400/EventList", "EventDetails" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
}
if [message] =~ /^<BehaviourBlockEvent>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "BehaviourBlockEvent/MachineInfo", "HostDetails" ]
xpath => [ "BehaviourBlockEvent/ScannerSoftware", "EventDetails" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
}
if [message] =~ /^<UpdateEvents>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "UpdateEvents/MachineInfo", "HostDetails" ]
xpath => [ "UpdateEvents/McAfeeCommonUpdater", "EventDetails" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
}
if [message] =~ /^<DLPAGENT9300>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "DLPAGENT9300/MachineInfo", "HostDetails" ]
xpath => [ "DLPAGENT9300/EventList", "EventDetails" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
}
if [message] =~ /^<EPO[Ee]vent>/ {
xml {
source => 'message'
store_xml => false
xpath => [ "EPOevent/MachineInfo", "HostDetails" ]
xpath => [ "EPOevent/SoftwareInfo", "EventDetails" ]
xpath => [ "EPOevent/SoftwareInfo/Event/CommonFields", "CommonDescription" ]
xpath => [ "EPOevent/SoftwareInfo/CommonFields", "CommonDescription" ]
}
xml {
source => HostDetails
target => MachineDetails
}
xml {
source => EventDetails
target => Event
}
xml {
source => CommonDescription
target => Common
}
if [message] =~ /<CustomFields/ {
xml {
source => 'message'
store_xml => false
xpath => [ "EPOevent/SoftwareInfo/Event/CustomFields", "CustomDescription" ]
}
}
xml {
source => CustomDescription
target => Custom
}
}
mutate {
remove_field => [ "message" ]
remove_field => [ "HostDetails" ]
remove_field => [ "EventDetails" ]
}
}