Parsing csv file which contains xml data as a field

Hello , I have a csv file in which one of the fields contains xml data. I am using csv filter in order to parse the document but logstash is unable to parse it . The error is : CSV::MalformedCSVError: Illegal quoting in line 1.>

Xml data has no new line char so I didn't use multiline codec . Suppose that the csv file is as following :
20170808154540830|<?xml version: "1.0" encoding="UTF-8" standalone="yes"?>|Success

can you suggest me a way to parse the file with below config?

input {
file {
path => "/path/*.csv"
start_position => “beginning”
}
}
filter {
csv {
separator => "|"
columns => [“timestamp”,“msg”,“state”]
}
}
output {
stdout { codec => json }
}

I'd I suggest using dissect plugin.

 dissect {
    mapping => {
        "message" => "%{date}|%{msg}|%{status}"
    }
  }

https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html

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