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

beat.sh script cannot use a custom config path #2171

Closed
tsg opened this issue Aug 3, 2016 · 3 comments
Closed

beat.sh script cannot use a custom config path #2171

tsg opened this issue Aug 3, 2016 · 3 comments
Assignees

Comments

@tsg
Copy link
Contributor

tsg commented Aug 3, 2016

In alpha5 we added the option to use the -c multiple times. This somewhat breaks the beat.sh scripts that we put in the /usr/bin for DEB/RPM installations (the beat binary is not in $PATH by default).

Here is an example of a script:

#!/bin/bash

# Script to run {.beat_name} in foreground with the same path settings that
# the init script / systemd unit file would do.

/usr/share/filebeat/bin/filebeat -e \
  -c /etc/filebeat/filebeat.yml \
  -path.home /usr/share/filebeat \
  -path.config /etc/filebeat \
  -path.data /var/lib/filebeat \
  $@

One of the things that was possible in alpha4 was to specify a custom config file, e.g.:

filebeat.sh -e -c filebeat.yml

This was overriding the default config file from the script with filebeat.yml. With alpha5, however, the Beat combines the two configuration files, which comes as a surprise for the user.

@tsg
Copy link
Contributor Author

tsg commented Aug 3, 2016

IMO, the best solution would be if the default value for -c is filebeat.yml which is searched in path.config. Then we don't need to put it explicitly in the script, and the user can override it with -c passed to the script.

Have to check if this is a viable solution, I know we had issues with this approach before, but I think that was before introducing the config paths.

@urso
Copy link

urso commented Aug 8, 2016

I think by default (if no -c is given), filebeat should load config file from ${path.config}/filebeat.yml by default. Solution might be to remove -c from script altogether. If removing -c doesn’t work properly we indeed have a bug in filebeat itself.

@tsg tsg self-assigned this Aug 11, 2016
tsg pushed a commit to tsg/beats that referenced this issue Aug 12, 2016
This is a proposal fix for elastic#2171. There's a bit of a chicken and egg
problem here, since defining the paths requires the configuration file
and the other way around. The implemented logic is to:

* if the `-path.config` flag is used, look for the config file relative to
  it
* if not, but `-path.home` flag is used, look for the config file relative
  to the home path
* else, look into the binary location, mostly for backwards compatibility

I'm not sure we need the last point, we could leave it relative to the cwd,
like most tools would do it. But this requires a BWC break.
urso pushed a commit that referenced this issue Aug 13, 2016
This is a proposal fix for #2171. There's a bit of a chicken and egg
problem here, since defining the paths requires the configuration file
and the other way around. The implemented logic is to:

* if the `-path.config` flag is used, look for the config file relative to
  it
* if not, but `-path.home` flag is used, look for the config file relative
  to the home path
* else, look into the binary location, mostly for backwards compatibility

I'm not sure we need the last point, we could leave it relative to the cwd,
like most tools would do it. But this requires a BWC break.
@tsg
Copy link
Contributor Author

tsg commented Aug 15, 2016

Fixed by #2245.

@tsg tsg closed this as completed Aug 15, 2016
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

2 participants