I am running python script which is capturing snmptrap and printing the data in console whenever there is trap. But while running the script from logstash manually I can check python script running in background, it is not printing the data. Or to be more precise data is displaying only after closing the logstash process (which I am running manually)
I used exec and pipe input plugin, nothing worked. Please help me here.
So you need your script to keep running, isn't just something that you run and it prints an output and exit. As I said, I don't think you can use the exec input for scripts like that.
The exec input is for things that you run, execute some logic and prints an output, not for long running scripts that periodically print stuff, you will only get the script output after it stopped running, this is the expected behavior of the exec input.
If you want to use this python script you will need to change it and make it output to a file or to a port and configure your logstash to read from the file or listen on the port.
Thanks @leandrojmp for your suggestion. I am using pipe input plugins to long run python script, and also http input plugins to open a new port on local. Further python script is posting all the incoming event to that port (modified the print section in the python script itself)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.