Logstash XML file


(Yirou) #1

Hello,
I need to parse XML file and send content to EL. It's work for XML input without space before xml tag like that :
<?xml version="1.0" encoding="utf-8"?>
<file>
<tag1>tag1</tag1>
<tag2>tag2</tag2>
</file>
but when file have space bebore XML tag,
eg: SPACE<?xml version="1.0" encoding="utf-8"?>
Logstash don't send any data. I know that i should write a pattern to remove space. I use strip without success.
this is my pattern:
codec => multiline {
pattern => "^<?file .*>"
negate => "true"
what => "previous"
auto_flush_interval => 5
}

Thanks for help


(Yirou) #2

Hi,
I found solution. I use gsub to remove space
gsub => ["message","SPACE<?xml version="1.0" encoding="utf-8"?>",""]

Thanks


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.