XML filter not able to parse message if it contains xml version.
Logstash able to parse xml perfectly with message:
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"><RegistrationInfo> <Date>2007-12-14T13:46:47.34375</Date> <Author>WIN-R9H529RIO4Y\Administrator</Author> <Description>Kick of night jobs</Description></RegistrationInfo></Task>
But Logstash not able to parse xml message:
**<?xml version="1.0" encoding="UTF-16"?>**<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"><RegistrationInfo> <Date>2007-12-14T13:46:47.34375</Date> <Author>WIN-R9H529RIO4Y\Administrator</Author> <Description>Kick of night jobs</Description></RegistrationInfo></Task>
How to handle this with logstash xml filter?
my logstash conf:
xml {
remove_namespaces => "true"
source => "message"
target => "@metadata[xml_content]"
force_array => false
}
ruby {
code => '
event.get("@metadata[xml_content]").each do |key, value|
event.set(key.downcase, value)
end
'
}
Thanks in advance.