# Convert multiline csv data to single line during filter

**URL:** https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741
**Category:** Logstash
**Created:** [May 21, 2020, 1:05pm UTC](https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741 "2020-05-21T13:05:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)
#### Post date: [May 21, 2020, 1:05pm UTC](https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741/1 "2020-05-21T13:05:36Z")

</div>

HI All

Currently after input i get data in this format

```
{
"csvdata" : "col1","col2","col3"
}
{
"csvdata" : "col1row1","col2row1","col3row1"
}
{
"csvdata" : "col1row2","col2row2","col3row2"
}

```

How should i club this mutiline event to a single line at filter level?  
What filter i use it to make it work?  
My expected output is

> {  
> " **csvdata**": "col1","col2","col3"  
> "col1row1","col2row1","col3row1"  
> "col1row2","col2row2","col3row2"  
> }

Thanks

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 21, 2020, 2:49pm UTC](https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741/2 "2020-05-21T14:49:37Z")

</div>

> [@rkhapre](#):
>
> {  
> " **csvdata**": "col1","col2","col3"  
> "col1row1","col2row1","col3row1"  
> "col1row2","col2row2","col3row2"  
> }

That is not valid JSON.

---

<div class="post-metadata">

### Author: ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)
#### Post date: [May 22, 2020, 2:07pm UTC](https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741/3 "2020-05-22T14:07:12Z")

</div>

Hi @Badger

I mean to say this way, my expectation is this format of json, please consider this

> {  
> " csvdata ": "col1,col2,col3\n  
> col1row1,col2row1,col3row1\n  
> col1row2,col2row2,col3row2"  
> }

Regards,  
Ritesh

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 19, 2020, 2:07pm UTC](https://discuss.elastic.co/t/convert-multiline-csv-data-to-single-line-during-filter/233741/4 "2020-06-19T14:07:14Z")

</div>

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