Running filebeat as a binary, got log ERR on invalid config file

Hello,
I am trying to package and run filebeat as a self-contained binary, as opposed to running it as system service: "sudo /etc/init.d/filebeat start"

I supplied various path parameters in command line when running filebeat in the following example:
./filebeat -path.home /usr/share/filebeat -path.config /home/yyu/tools/filebeat -path.data /home/yyu/cloud/external/src/github.com/elastic/beats/filebeat/yy -path.logs /home/yyu/cloud/external/src/github.com/elastic/beats/filebeat/yy

This seems working fine except the error message in the log file.
2017-07-11T16:38:53-07:00 ERR Error loading config: invalid config: open /etc/filebeat/filebeat.yml: permission denied

however, the first line in the log file is:
2017-07-11T16:38:43-07:00 INFO Home path: [/usr/share/filebeat] Config path: [/home/yyu/tools/filebeat] Data path: [/home/yyu/cloud/external/src/github.com/elastic/beats/filebeat/yy] Logs path: [/home/yyu/cloud /external/src/github.com/elastic/beats/filebeat/yy]

I am confused by the above two conflicting log messages, INFO says the config path is home/yyu/tools/filebeat, which is correct. However, the log ERR message says the config path is /etc/filebeat??

Could someone please shed some lights on this?
thanks!
yan

What version are you testing?

./filebeat --version
filebeat version 6.0.0-beta1 (amd64), libbeat 6.0.0-beta1

I git cloned yesterday afternoon (PCT), and build it from the master branch

I wasn't able to reproduce this. I am seeing it attempt to read filebeat.yml in whatever directory I specify in the -path.config option.

$ ./filebeat -e -d "*" -path.config /tmp
filebeat2017/07/13 17:30:26.210137 beat.go:650: CRIT Exiting: error loading config file: stat /tmp/filebeat.yml: no such file or directory
Exiting: error loading config file: stat /tmp/filebeat.yml: no such file or directory
1 Like

never mind, i found the reason, it is due to the config file.
in the filebeat.yml which I copied from the default provided with the package, it kept the following line.
filebeat.config.prospectors:
path: /etc/filebeat/*.yml
reload.enabled: true
reload.period: 10s

Sorry for the false alarm, it is not code bug. However, I am wondering why the config file path could be specified both in the command line and inside config file itself.
It is very strange that the config file path is specified inside the config file itself, since if we can read the config file, it means that we already know the config file path, then it does not need to be specified in the config file; otherwise, it is pointless to set the config file path inside the config file.

The path specified in the config file is supposed to point to a "conf.d" like directory where you can drop in application specific filebeat config (like for apache or nginx). It's not supposed to point to itself and it doesn't appear to https://github.com/elastic/beats/blob/v6.0.0-alpha2/filebeat/filebeat.full.yml#L432.

1 Like

oops, my bad,
I must have misunderstood the comments in the default config file initially, I thought I need to add this in the config file in order for filebeat to reload the config file periodically. then i completely forgot that i added this:(
so filebeat will reload config file regardless of whether
the config path is supplied in command line or in the config file itself? thanks!

  # Enable filebeat config reloading
  #filebeat.config.prospectors:
  #enabled: false
  #path: configs/*.yml

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