How can I receive path from another file in logstash?

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

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.

1 Like

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

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.

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

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.

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