# How to remove transferred logs with Logstash?

**URL:** <https://discuss.elastic.co/t/how-to-remove-transferred-logs-with-logstash/318249>\
**Category:** Logstash\
**Created:** [November 6, 2022, 7:21am UTC](https://discuss.elastic.co/t/how-to-remove-transferred-logs-with-logstash/318249 "2022-11-06T07:21:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir\_Routine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladimir_routine/32/51618_2.png) [@Vladimir\_Routine](https://discuss.elastic.co/u/Vladimir_Routine)\
**Post date:** [November 6, 2022, 7:21am UTC](https://discuss.elastic.co/t/how-to-remove-transferred-logs-with-logstash/318249/1 "2022-11-06T07:21:08Z")

</div>

I want to use Logstash to move my log files from Mongodb to Elasticsearch. Is there any option to remove transferred logs from mongo?

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [November 7, 2022, 5:58am UTC](https://discuss.elastic.co/t/how-to-remove-transferred-logs-with-logstash/318249/2 "2022-11-07T05:58:21Z")

</div>

Hello Vladimir,

Unfortunately, I think this is not possible directly. Although the elasticsearch output has this [option](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action) this option is not added to the mongodb output (see open issue [here](https://github.com/logstash-plugins/logstash-output-mongodb/issues/16)).

If you really need a **logstash** pipeline to **delete** the logs you could be writing a small pipeline reading from elasticsearch and use the [exec output plugin](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-exec.html) to run a script that deletes the entries.

Best regards  
Wolfram

---

<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:** [December 5, 2022, 5:58am UTC](https://discuss.elastic.co/t/how-to-remove-transferred-logs-with-logstash/318249/3 "2022-12-05T05:58:37Z")

</div>

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