# Creating multiple output files in Logstash

**URL:** <https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517>\
**Category:** Logstash\
**Created:** [June 22, 2017, 7:04pm UTC](https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517 "2017-06-22T19:04:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepthi\_V](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Deepthi\_V](https://discuss.elastic.co/u/Deepthi_V)\
**Post date:** [June 22, 2017, 7:04pm UTC](https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517/1 "2017-06-22T19:04:43Z")

</div>

Hello,

I have my input section where I have a given path which has multiple directories and log files in it. I have written the following:

input {  
file {  
path =\> "/home/deepthi/Desktop/logs/\*\*/\*.log"  
}  
}

I want to create multiple output files in the output section with the same name as the input file name and just append '-logoutput.log' at the end of the filename. Can anybody please tell me how this can be achieved in Logstash?

Thanks in advance!

Deepthi

---

<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:** [June 24, 2017, 7:15pm UTC](https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517/2 "2017-06-24T19:15:49Z")

</div>

The path to the input file is added to the `path` field. You can reference that field in your file output configuration:

```
path => "%{path}-logoutput.log"

```

[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references)

---

<div class="post-metadata">

**Author:** ![Deepthi\_V](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Deepthi\_V](https://discuss.elastic.co/u/Deepthi_V)\
**Post date:** [June 28, 2017, 9:57pm UTC](https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517/3 "2017-06-28T21:57:12Z")

</div>

I got this working! Thank you very much Magnus

---

<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 26, 2017, 9:57pm UTC](https://discuss.elastic.co/t/creating-multiple-output-files-in-logstash/90517/4 "2017-07-26T21:57:30Z")

</div>

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