Using Logstash as a Build Trigger (output exec?)

Hi everyone,

I'm trying to use Logstash to trigger a simple script when receiving a certain type of log.

After reading the documentation I presumed something like:
output{ exec { command => "myscript" } }
would prove to be a simple way to implement this but have had lots of issues getting exec to play nicely in my workspace.

Before I continue down this avenue, is this the ideal way to pursue this goal? Are there other tools that I am not aware of? Should Logstash be used as a build trigger at all?

Also, if output exec is the proper way to attack this goal, are there any easy to follow instruction on how to properly configure its dependencies so someone with little to no ruby experience could follow?

Thanks in advance!

Just to clarify, here is the error I kept receiving when trying to run logstash under a configuration containing the exec directive:

17:03:21.832 [LogStash::Runner] ERROR logstash.agent - Cannot load an invalid configuration {:reason=>"Couldn't find any output plugin named 'exec'. Are you sure this is correct? Trying to load the exec output plugin resulted in this error: Problems loading the requested plugin named exec of type output. Error: NameError NameError"}

It looks like you need to install the exec output plugin. Plugin installation is described in the documentation.

Before I continue down this avenue, is this the ideal way to pursue this goal? Are there other tools that I am not aware of? Should Logstash be used as a build trigger at all?

I've never heard of anyone using Logstash as a build trigger, but sure. Keep in mind that the command is by default run synchronously (i.e. Logstash waits until it completes) so you should put it to the background, e.g. by appending & to the command.

There are probably other ways of triggering builds from Logstash but it's hard to help without more details about what you're actually doing. I'd prefer starting a build that's entirely decoupled from Logstash, e.g. by firing off an HTTP request.

1 Like

I'm also finding a way for implementing a HTTP service which that fires a HTTP request which will perform logstash operations. But I still don't have a clear idea about implementing such a service. So could you describe more on that topic please?

@Nisal_Thiwanka
Your question looks totally different from the OP. Please create a new question with more detail. If you think this thread is relevant you could link to this one as "possibly related".

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