# Add a csv input for every batch

**URL:** <https://discuss.elastic.co/t/add-a-csv-input-for-every-batch/326553>\
**Category:** Logstash\
**Created:** [February 27, 2023, 8:23am UTC](https://discuss.elastic.co/t/add-a-csv-input-for-every-batch/326553 "2023-02-27T08:23:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [February 27, 2023, 8:23am UTC](https://discuss.elastic.co/t/add-a-csv-input-for-every-batch/326553/1 "2023-02-27T08:23:19Z")

</div>

Hello,

I am using http\_poller input plugin and elasticsearch output plugin.. I want to use CSV output plugin also for logging logstash success in a CSV file..But in my CSV all the events are noted but not only once.  
I want to note the log in csv for only once for every plugin batch. How can I do that..

I tried doing it using aggregate filter but it is not working properly.

```auto
  aggregate {
      task_id => "%{[@metadata][fingerprint]}"
      code => "event.set('is_batch_complete', true)"
      push_previous_map_as_event => true
      timeout => 300
      timeout_tags => ['_aggregatetimeout']
      timeout_code => "event.set('is_batch_complete', true)"
    }
if [is_batch_complete] {
		  csv {
			fields => ["batch_timestamp"]
			path => "success-log\se-logstash-success-log-%{+YYYY-MM}.csv"
		  }
		}

```

---

<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:** [March 27, 2023, 8:24am UTC](https://discuss.elastic.co/t/add-a-csv-input-for-every-batch/326553/2 "2023-03-27T08:24:18Z")

</div>

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