Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up modules when Logstash is running as a service #8709

Open
ycombinator opened this issue Nov 22, 2017 · 6 comments
Open

Setting up modules when Logstash is running as a service #8709

ycombinator opened this issue Nov 22, 2017 · 6 comments

Comments

@ycombinator
Copy link
Contributor

ycombinator commented Nov 22, 2017

Currently, in order to setup Logstash modules (e.g. netflow), there is a first-time setup command that must be run, like so:

bin/logstash --modules MODULE_NAME --setup [-M "CONFIG_SETTING=VALUE"]

This command creates the necessary artifacts in Elasticsearch and Kibana such as Elasticsearch templates, Kibana visualizations, and Kibana dashboards. It also starts up a Logstash pipeline for the given module, which keeps the Logstash process running.

Thereafter, to create additional pipelines for the given module, the same command sans --setup must be invoked:

bin/logstash --modules MODULE_NAME [-M "CONFIG_SETTING=VALUE"]

This pattern works well when Logstash is installed as a standalone program, typically from its .tar.gz or .zip build artifact.

However, when Logstash is installed as a service, typically from its .deb or .rpm build artifact, this pattern starts to break down. Specifically, with Logstash running as a service, how can the first-time --setup step be invoked?

@ycombinator
Copy link
Contributor Author

ycombinator commented Nov 22, 2017

FWIW, this (specifically step 4 below) is how Beats seems to be solving for this use case, by making the Beat in question a service and a command both:

screen shot 2017-11-22 at 3 12 40 am

@ycombinator
Copy link
Contributor Author

ycombinator commented Nov 22, 2017

For the Beats pattern to be applied to Logstash, two changes would be required:

  1. Make logstash available as a command as well as a service. This would require placing the logstash executable in the system path. Currently Logstash is installed as a service but can be executed as a command if the install path is known (e.g. when installed via a .deb package, Logstash can be executed as a command by running /usr/share/logstash/bin/logstash).

  2. Make logstash --modules MODULE_NAME --setup run and exit. Currently the command starts up the pipeline for the module so continues to run without exiting.

@ycombinator ycombinator self-assigned this Nov 29, 2017
@ycombinator
Copy link
Contributor Author

ycombinator commented Nov 29, 2017

These are the minimal changes required to deliver an MVP:

In 6.0.0 and 6.1.0

  • Honor --setup as-is (continues running the process)

In 6.2.0 - 6.x

  • Honor --setup as-is (continues running the process)
  • Also provide --setup-and-exit flag which will do the setup and then exit (Add new --setup-and-exit flag for Logstash module setup #8767)
  • If both --setup and --setup-and-exit are specified, fail and let user know the flags are mutually exclusive.
  • Add --setup-and-exit to docs

In 7.0.0

  • Change the meaning of --setup to do the setup and then exit
  • Deprecate --setup-and-exit (make it do the same thing as before but also log a warning about using --setup instead and this flag becoming obsolete in the future)
  • Update docs to use --setup

In 8.0.0

  • Obsolete --setup-and-exit (fail with error message to use --setup instead)

@acchen97
Copy link
Contributor

acchen97 commented Dec 8, 2017

@ycombinator as discussed yesterday, I think we should add the --setup-and-exit option and still retain the --setup command for the long term as there are use cases for both.

For deb/rpm running as a service:

  1. Run --setup-and-exit to bootstrap
  2. Run module as a service without additional setup options

For tar/zip standalone: just run --setup to both bootstrap and spin up LS pipeline

/cc @tbragin

@ycombinator
Copy link
Contributor Author

I'm good with this approach. @jordansissel what are you thoughts, since it differs from our original proposal?

@ycombinator ycombinator assigned jsvd and unassigned ycombinator Dec 11, 2017
@markandrewj
Copy link

I came across this today, a --setup-and-exit flag would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants