How can I receive path from another file in logstash?


(Narayan Krish) #1

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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


(Magnus Bäck) #2

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.


(Narayan Krish) #3

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?????


(Magnus Bäck) #4

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.


(Narayan Krish) #5

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


(Magnus Bäck) #6

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.


(system) #7

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