Filtering XML input in Logstash



I have an XML file as an input in Logstash. I want to process and store only the header of the input, I dont care about the rest of the file. I have an input configured such as:
file {
path => "/home/test/file.xml"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => multiline {
pattern => "Header"
negate => false
what => "previous"
My configuration partially works as I read the data from header, but then I get a number of JSON outputs, containing just the timestamp, as the data after the header is not matched. I would like to keep the header, but not the "empty" JSON output afterwards. Whats the best way to configure my input, to only match the header and ignore the rest?

(system) #2

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