Run Logstash using Java program

Hi,

I would like to implement a program which runs Logstash with my custom config file. I wish to implement the program based on Java language. Is there anyone knows how to do it? Do I just run command like "./logstash -f configfile.config" using Java program? Is there any api library for Java?

Thank,

What is the point of this?

Thank you for answering. I wish to run Logstash when I want. So I would like to write Java program which runs Logstash. For now, I wrote Java code using Runtime class to run this "./logstash -f configfile.config". Is there better way to run Logstash using Java code?

For now, I wrote Java code using Runtime class to run this "./logstash -f configfile.config". Is there better way to run Logstash using Java code?

Theoretically you might be able to load the Logstash jars in a new classloader and fire it up, but that's not supported. Just start Logstash like you'd do from any other language.