# How can I receive path from another file in logstash?

**URL:** https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789
**Category:** Logstash
**Created:** [September 8, 2017, 5:10am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789 "2017-09-08T05:10:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Akrishna](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Akrishna](https://discuss.elastic.co/u/Akrishna)
#### Post date: [September 8, 2017, 5:10am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/1 "2017-09-08T05:10:36Z")

</div>

example:-

input {  
file  
{  
path =\>pipe{command =\> "cat /home/xyz/Logstash/logstash\_logstashconf/directories.csv"}  
}  
}

////////////////////// Content inside directories.csv /////////////////////////  
["/home/sys/logstash\_test/errorlog/166653\_Tfg\_TestFile.out","/home/sys/logstash\_test/errorlog/163353\_Ben\_TestFile.out"]

But, this does not work..  
Is there any other way???

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Replay ASAP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

---

<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: [September 8, 2017, 8:26am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/2 "2017-09-08T08:26:29Z")

</div>

To answer this question we need to understand why you want to do this. What's your end goal? Why can't you store the filename or filename pattern in the Logstash configuration file?

> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Replay ASAP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If you want to annoy volunteers like me this is a great way to start.

---

<div class="post-metadata">

### Author: ![Akrishna](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Akrishna](https://discuss.elastic.co/u/Akrishna)
#### Post date: [September 8, 2017, 9:04am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/3 "2017-09-08T09:04:15Z")

</div>

> [@magnusbaeck](#):
>
> To answer this question we need to understand why you want to do this. What's your end goal? Why can't you store the filename or filename pattern in the Logstash configuration file?

No, I cannot store the finame or the filename pattern. Since the directories.csv is a output file generated from another Logstash component.  
And thus the path is subject to change accordingly.  
So any idea on how to achieve this?????

---

<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: [September 8, 2017, 9:18am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/4 "2017-09-08T09:18:51Z")

</div>

You could generate the configuration file you need (either directly from your other Logstash component) or via an extra script that detects that the file you're currently generating has changed.

---

<div class="post-metadata">

### Author: ![Akrishna](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Akrishna](https://discuss.elastic.co/u/Akrishna)
#### Post date: [September 8, 2017, 9:26am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/5 "2017-09-08T09:26:30Z")

</div>

Could you please explain in detail.  
A short example will be really helpful!  
TIA!

---

<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: [September 8, 2017, 10:47am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/6 "2017-09-08T10:47:36Z")

</div>

What I'm saying is that you can create a small program (e.g. a shell script) that reads directories.csv and writes a Logstash configuration file.

---

<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: [October 6, 2017, 10:48am UTC](https://discuss.elastic.co/t/how-can-i-receive-path-from-another-file-in-logstash/99789/7 "2017-10-06T10:48:00Z")

</div>

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