# Logstash - JSON Parsing is very slow

**URL:** <https://discuss.elastic.co/t/logstash-json-parsing-is-very-slow/204704>\
**Category:** Logstash\
**Created:** [October 22, 2019, 5:48pm UTC](https://discuss.elastic.co/t/logstash-json-parsing-is-very-slow/204704 "2019-10-22T17:48:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raviep](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@raviep](https://discuss.elastic.co/u/raviep)\
**Post date:** [October 22, 2019, 5:48pm UTC](https://discuss.elastic.co/t/logstash-json-parsing-is-very-slow/204704/1 "2019-10-22T17:48:16Z")

</div>

Hi,

I need to parse elastic search response JSON to CSV using logstash.

## JSON File:

{  
"took" : 11,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 3,  
"successful" : 3,  
"skipped" : 0,  
"failed" : 0  
},  
"hits" : {  
"total" : 2434,  
"max\_score" : null,  
"hits" : [  
{  
"\_index" : "index1",  
"\_type" : "type1",  
"\_id" : "id",  
"\_score" : null,  
"fields" : {  
"field1" : [  
"454"  
],  
"field2" : [  
"777"  
],  
"field3" : [  
"6767"  
]  
}  
}  
{  
"\_index" : "index1",  
"\_type" : "type1",  
"\_id" : "id2",  
"\_score" : null,  
"fields" : {  
"field1" : [  
"242"  
],  
"field2" : [  
"434"  
],  
"field3" : [  
"2323"  
]  
}  
}  
]  
}  
}

## Logstash configuration:

input{  
file{  
type =\> "json"  
codec =\> "json"  
path =\> "/usr/share/logstash/bin/input.json"  
start\_position =\> beginning  
}  
}  
filter{  
json { source =\> "message" }

split{  
field =\> "[hits][hits]"  
}  
}  
output {  
csv{  
fields =\> ["[hits][hits][fields][field1][0]","[hits][hits][fields][field2][0]","[hits][hits][fields][field3][0]"........]  
path =\> "/usr/share/logstash/bin/output.csv"  
}  
}

It converts JSON to CSV successfully but it takes too much time to convert. Example: It takes 20 minutes to convert 10000 records.

Am I doing something wrong with logstash configuration?

Thanks,  
Ravi

---

<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:** [November 19, 2019, 5:48pm UTC](https://discuss.elastic.co/t/logstash-json-parsing-is-very-slow/204704/2 "2019-11-19T17:48:26Z")

</div>

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