No Logstash init script - RHEL 6.10

Hi.

We are running logstash version 5.5.0 on a RHEL 6.10 fully patched host.

Oddly when I deploy the ELK stack all the other applications get init scripts put in /etc/init.d however logstash seems to put it's script in /usr/share/logstash/bin.

This has made automation via puppet difficult.

The online Elasticsearch documentation found hereseems to suggest that for a RHEL 6.10 system using /sbin/init to start/stop the process you would use /etc/init.d/logstash stop/start/status etc (service logstash command).

However this is where it gets weird, on my system logstash is responding to initctl commands which as far as I know are not used by RHEL 6.10.

When I tried to automate the deployment of logstash via puppet I get a message that upstart is not a provider on this host!! And yet the upstart commands work on the cmd-line.

I have built my own init script to set the boot level for the service as well as control it via /sbin/init which in turn has enabled me to automate the process via puppet.

However why is the installation of logstash not auto generating an init script as it does for the other elements of the ELK stack?

Is this a bug?

Thanks

I would expect logstash to drop a file into /etc/init, not /etc/init.d, and to be managed using initctl.

Well you are right there is a logstash.conf file within /etc/init however there are no other .conf files in here for the other services in the ELK stack.

They are in /etc/init.d

The problem is this..... inictl is an upstart thing.

In puppet if I specify the provider as upstart when puppet runs it just complains that the host isn't an upstart host.

Which is why I went down this route of creating a more traditional init style service by creating my own init script in /etc/init.d

It works..... I'm just confused why there seems to be a difference with logstash compared to the other elements of the ELK stack.

One thing you should not expect from elastic is consistency. And they are not afraid of breaking changes, either :wink:

I just tested some changes. And it seems without a logstash init script within /etc/init.d it is not possible to automate this via puppet.

It does say on the logstash documentation that it doesn't run as a service. So I guess that's a clue.

My init script is simply making calls to initctl.

But at least it is now controllable via Puppet.

Hope this information helps someone else.

Hi,
In fact the rpm package does provide a daemon, but not in the same way that the older versions (If I remember well changes came in release 5.6).
You need first to select the init system to use (systemd, sysv, upstart..) and fill the /etc/logstash/startup.options that allows you tu customize a bit your logstash.
Then run the /usr/share/logstash/bin/system-install script and the daemon will be set with your custom values (and there will be a script in init.d)
You need to provide as arguments:

  • the path to startup.options file
  • the system you use among sysv, systemd or upstart.

Doc for starting logstash as a daemon: https://www.elastic.co/guide/en/logstash/6.3/running-logstash.html
Doc about startup.options: https://www.elastic.co/guide/en/logstash/6.3/config-setting-files.html#_settings_files

Note that unless jvm.options and logstash.yml, you cannot modify this file on-the-fly, need to rebuild the daemon first.

Hope it gaves some help.
Regards

edit: found the related commit which provide some doc/explanaition

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