# Write Logstash Data to a File While Preserving Original File Name

**URL:** <https://discuss.elastic.co/t/write-logstash-data-to-a-file-while-preserving-original-file-name/275841>\
**Category:** Logstash\
**Created:** [June 14, 2021, 1:50pm UTC](https://discuss.elastic.co/t/write-logstash-data-to-a-file-while-preserving-original-file-name/275841 "2021-06-14T13:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rod\_Guiamoy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rod_guiamoy/32/90259_2.png) [@Rod\_Guiamoy](https://discuss.elastic.co/u/Rod_Guiamoy)\
**Post date:** [June 14, 2021, 1:50pm UTC](https://discuss.elastic.co/t/write-logstash-data-to-a-file-while-preserving-original-file-name/275841/1 "2021-06-14T13:50:53Z")

</div>

Basically I'd like to have Logstash capture the original file name and reusing it when writing the logs to another location. As if you've just copy/pasted it. Use case would be for IIS logs where using \*.log captures all IIS logs regardless of dates and crams it into one file with no order.

---

<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 12, 2021, 1:51pm UTC](https://discuss.elastic.co/t/write-logstash-data-to-a-file-while-preserving-original-file-name/275841/2 "2021-07-12T13:51:17Z")

</div>

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