Unable to run logstash config file (permission denied)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:38:40

问题


my config file is stored in

/etc/logstash/ 

and I ran the command

$ /etc/logstash -f /etc/logstash/logstash.conf

as root.

However, they told me that permission denied when I tried to do that. Is there any way to solve this?


回答1:


As said, you need to run /opt/logstash/bin/logstash -f /etc/logstash/logstash.conf instead of /etc/logstash -f /etc/logstash/logstash.conf.

This is caused by the default directory structure of your Linux system which logstash uses to put its files in. Wikipedia: Filesystem Hierarchy Standard

/opt stands for optional and contains third party packages which are not part of the default linux distribution. Therefore logstash puts its binaries and some dependencies there (e.g. jRuby stuff). Here you can find the logstash program /opt/logstash/bin/logstash or the plugin manager /opt/logstash/bin/plugin.

/etc means et cetera and is often used for configuration files (like logstash uses it).

There are also other system folders which are used by logstash. For example /var/log/logstash where you can find logstash's own logs. So, when you run the logstash installation (in Ubuntu perhaps with apt-get or dpkg) it puts all the needed files in folders corresponding to the directory structure of your OS.

As you see, you cannot run /etc/logstash -f /etc/logstash/logstash.conf because /etc/logstash is not an executable but a directory.

However, if you run logstash in a command prompt you may also specify other paths for your config file (e.g. /opt/logstash/bin/logstash -f /home/user/logstash.conf). If you run it as a service you cannot provide a path to your config file. Then the default behaviour of logstash is to look for config files in /etc/logstash/




回答2:


Just a complement to the accepted answer. Perhaps you could check another two places:

  1. the right absoluate file path provided in your *.conf input;
  2. try to start by sudo bin/logstash -f your_config_file;


来源:https://stackoverflow.com/questions/32036002/unable-to-run-logstash-config-file-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!