# Logstash output question

**URL:** <https://discuss.elastic.co/t/logstash-output-question/38586>\
**Category:** Logstash\
**Created:** [January 7, 2016, 9:21am UTC](https://discuss.elastic.co/t/logstash-output-question/38586 "2016-01-07T09:21:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [January 7, 2016, 9:21am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/1 "2016-01-07T09:21:22Z")

</div>

Hi all,  
i'd like to know if it's possibile to write some custom text inside of a file, during a csv upload inside elastic search

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 7, 2016, 9:25am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/2 "2016-01-07T09:25:06Z")

</div>

Logstash doesn't send _files_ to Elasticsearch. It sends JSON documents, in your case created from CSV files. Do you want to create additional fields/properties in the JSON document created from each CSV line, or what do you want to accomplish?

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [January 7, 2016, 9:32am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/3 "2016-01-07T09:32:11Z")

</div>

beside sending JSONs to ES, i'd like to write a text file with the processed csv name and the number of records correctly uploaded n ES, i need this to manage csv reports better

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 7, 2016, 10:33am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/4 "2016-01-07T10:33:50Z")

</div>

Didn't you ask the same question a few days ago? I don't think there's a simple way of doing it. But can't you extract that information from ES instead? If you save the CSV filename in a field you can aggregate on the filename field and get back the document count per filename.

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [January 7, 2016, 11:04am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/5 "2016-01-07T11:04:22Z")

</div>

> [@magnusbaeck](#):
>
> I don't think there's a simple way of doing it

okay, but don't you have any idea about how this could be achieved? if you could give me some place to start it would be better, otherwise i am willing to hear some other reccomendation about how to execute it from ES, as you just mentioned. thank you

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 7, 2016, 12:10pm UTC](https://discuss.elastic.co/t/logstash-output-question/38586/6 "2016-01-07T12:10:34Z")

</div>

Use a [terms aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html) to query ES and get back a table of how many documents there are for each CSV file.

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [January 7, 2016, 1:17pm UTC](https://discuss.elastic.co/t/logstash-output-question/38586/7 "2016-01-07T13:17:41Z")

</div>

ok thanks, but there's another issue: every time i load records inside an index through csv not ALL of them gets adeed, many of these get to update pre-existing records, so it turns out to be difficult to assess that everything went at it should or if there have been any errors/exceptions

---

<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:** [July 6, 2017, 5:16am UTC](https://discuss.elastic.co/t/logstash-output-question/38586/8 "2017-07-06T05:16:32Z")

</div>


