Convert multiline csv data to a single line csv in filter

Hi All

I have a csv file, which gives me response in multiline csv, i need convert that in a single line csv,

Here is the data


if i use this below configuration, i get the response like this


my expected result it to get all the value of key "message" combined into a single value.
You can say its a case of combining all multiline csv value to a single line

{"message": "col1row1","col2row1","col3row1"


{"message": "col1row1","col2row1","col3row1"\n

This is my conf file

	file {
	      path => "/csv_data.csv"
		    sincedb_path => "/sincedb.txt"
          type => "csv"
          start_position => "beginning"
filter {
mutate {
remove_field => ["host","@version","@timestamp","type","path"]


	output {
	 file {
	   path => "/test.csv"


Please let me know how we can combine all the value. I also tried checking aggregation filter, but no example usecase found to be a valid for this


Use a multiline codec on the file input.

Hi @Badger , thanks for reply. yes this works well .
I was trying same in jdbc input, and this was not working there, can you please tell the reason. In both the case the its multiline

I am using this from one of your posts

codec => multiline { pattern => "^Spalanzani" negate => true what => "previous" auto_flush_interval => 2 }

The codec option can be set on a jdbc input, but it is ignored.

oh ! that means this cannot be solved. Do you know how we can solve this through aggregation filter or a ruby code?

Hi @Badger, can you provide any suggestion as how we can achieve this for jdbc source

If you want to combine rows from the DB then an aggregate filter might be appropriate.

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