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

Comments

Projects
None yet
2 participants
@tsg
Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator Author

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

This comment has been minimized.

Copy link
Collaborator

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 added a commit to tsg/beats that referenced this issue Aug 11, 2016

Look for the config files relative to the path.config flag
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.

tsg added a commit to tsg/beats that referenced this issue Aug 11, 2016

Look for the config files relative to the path.config flag
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.

tsg added a commit to tsg/beats that referenced this issue Aug 11, 2016

Look for the config files relative to the path.config flag
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.

tsg added a commit to tsg/beats that referenced this issue Aug 12, 2016

Look for the config files relative to the path.config flag
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.

tsg added a commit to tsg/beats that referenced this issue Aug 12, 2016

Look for the config files relative to the path.config flag
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.

tsg added a commit to tsg/beats that referenced this issue Aug 12, 2016

Look for the config files relative to the path.config flag
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 added a commit that referenced this issue Aug 13, 2016

Look for the config files relative to the path.config flag (#2245)
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

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 15, 2016

Fixed by #2245.

@tsg tsg closed this Aug 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.