Salmaan P
Salmaan P

Reputation: 847

Logstash parse multiline CSV file

I have a CSV file with some fields which contain "\n". The field is in quotes, so it displays properly on excel or using pandas in python. However using the CSV filter in logstash doesn't work properly and gives either CSV parse error or wrong fields. Anyone who has experience with this before?

I also saw this issue on github: https://github.com/logstash-plugins/logstash-filter-csv/issues/34 but it's a year old.

Upvotes: 1

Views: 3006

Answers (1)

Miso Mijatovic
Miso Mijatovic

Reputation: 357

have you tryed the multiline codec?

You should add something like this in your input plugin:

codec => multiline {
      pattern => "^[0-9]"
      negate => "true"
      what => "previous"
    }

it tells logstash that every line not starting with a number should be merged with the previous line

see Loading csv in ElasticSearch using logstash

Upvotes: 3

Related Questions