Ask Your Question

Automating logstash pipeline

asked 2018-07-11 05:26:32 -0600

andrewmichael81 gravatar image

Need some help automating the starting of a logstash pipeline. The issue is when you start the pipeline from the cmdline it doesn't drop to a shell after starting, meaning that puppet eventually times out even tho it is successful.

My code looks like this:

exec { '/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf': provider => 'shell', onlyif => "if [[ ps -ef | grep /etc/logstash/conf.d/logstash.conf | grep -v grep | awk '{print $NF}' == logstash.conf ]]; then exit 1 ; else exit 0; fi;", }

I've tried to background the job but the logstash pipeline still outputs to standout.

edit retag flag offensive close merge delete


OK,I'm trying a different approach found here: I am on RHEL 6 and sudo initctl start logstash does indeed start logstash. However when I add upstart as a provider it is telling me 'Provider upstart is not functional on this host'

andrewmichael81 gravatar imageandrewmichael81 ( 2018-07-11 05:53:58 -0600 )edit

service { 'logstash': enable => true, ensure => 'running', require => Package['logstash-5.5.0'], provider => upstart, }

andrewmichael81 gravatar imageandrewmichael81 ( 2018-07-11 05:58:00 -0600 )edit

I could combine them like this: exec { 'initctl start logstash': provider => 'shell', onlyif => "if [[ ps -ef | grep /etc/logstash/conf.d/logstash.conf | grep -v grep | awk '{print $NF}' == logstash.conf ]]; then exit 1 ; else exit 0; fi;", }

andrewmichael81 gravatar imageandrewmichael81 ( 2018-07-11 05:58:17 -0600 )edit

You should probably look to use the official elastic logstash module -

DarylW gravatar imageDarylW ( 2018-07-11 08:12:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-12 04:51:12 -0600

andrewmichael81 gravatar image

updated 2018-07-12 04:51:56 -0600

In the end I have written my own init script. And it seems to have worked.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-07-11 05:26:32 -0600

Seen: 79 times

Last updated: Jul 12