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?
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/
Just a complement to the accepted answer. Perhaps you could check another two places:
the right absoluate file path provided in your *.conf input;
try to start by sudo bin/logstash -f your_config_file;
Related
On Linux (Ubuntu 20.04), using yarn 3.2.0, had an issue where yarn install would always fail with a number of "permission denied" during the Link step, where it was trying to use other modules installed in node_modules as part of the same install (e.g. node-gyp, node-gyp-build, node-pre-gyp, prebuild-install).
Turns out after a long period of investigation (mainly focused on file permissions because of the permission denied error) that it was in fact down to Yarn's use of the /tmp folder, which it apparently uses during its Link step for placing and executing some files. This is all very well, but not on a Linux server which is following "best practice" in having the noexec flag on the /tmp mount point (see: /opt/fstab) ! noexec prevents use of executables, hence the permission denied. If I take the noexec flag off yarn works flawlessly.
So the question is, how do I get around this behaviour in Yarn so that I don't have to break best practice on the /tmp folder? I have dug hard into yarn's configuration options but there appears to be nothing in this area.
Fortunately, Yarn is respecting standard TMPDIR variable. I'm guessing it is using standard NodeJS os.tmpdir() method which supports this.
Citing Wikipedia's page about TMPDIR:
TMPDIR is the canonical environment variable in Unix and POSIX that should be used to specify a temporary directory for scratch space. Most Unix programs will honor this setting and use its value to denote the scratch area for temporary files instead of the common default of /tmp or /var/tmp.
You can easily do something like:
mkdir ~/tmp && export TMPDIR=~/tmp && yarn install
Btw. I went through same deal, spending too much time chasing those weird permission denied errors and forgetting, that it is executed in /tmp. It would be amazing if Yarn would detect this automatically.
Somehow, my system (Ubuntu WSL layer on Windows; so treat as exactly Ubuntu) went a bit crazy. For a directory (a git repo if it matters) /path/to/foo, running ls shows the git files ORIG_HEAD, index, and index.lock in there.
I tried to debug this by going cd .git, but an ls there showed me my same list of files as the parent!
I went as far as
/path/to/foo/.git/.git/.git
before stopping checking the recursion.
A possibly related issue that managed to show up is that the .htaccess file there is read as a file by Emacs on Windows, a file by vi on Linux, but a directory by emacs and a directory by bash.
That means that my computer really thinks
~/public_html/.git/.htaccess/.htaccess/.git/.htaccess/.git/.git
is identical to
~/public_html
So, needless to say, Apache also craps out and says that it's an invalid htaccess file .... though on an other machine (see: git repo) it runs just fine.
Help?
Tried nuking the directory via rm -rf and git clone-ing back, but the Apache problem persisted.
I removed the symlink to the directory via unlink:
~$ unlink public_html
then re-mounted it, making sure that there wasn't a trailing space
~$ ln -s /mnt/c/Users/USER/pathto/repo /home/USER/public_html
Is there a way to prevent the rpmbuild command from reading the ~/.rpmmacros file? I want to add rpmbuild to a Make target and want to get a consistent build under any user account, regardless of the options somebody might have personally set in the rpmmacros file in his home directory.
How can I do this? Or, is that actually a bad idea?
If you're looking to get the a consistent build then the rpmmacros is only one part of the problem. The build may still differ simply because it's running on a machine with different things installed. Use mock to get a truly consistent build environment.
Solved this now this by setting $HOME to an empty directory while running rpmbuild:
mkdir $MY_DIST_DIR/dummyhome
HOME=$MY_DIST_DIR/dummyhome/ rpmbuild ...
rm -r $MY_DIST_DIR/dummyhome
Can anyone help me with installation?
I have install virtualEnv and trying to install both of these. but not sure it is correct or not.
I know this is an old version, but it worked for me on a different Linux build (Mate OS). Follow the steps in this blog post which I have simplified below.
Download the below
ERLANG from OTP R16B03-1 Source File
RabbitMQ from RabbitMQ Server.tar.gz
Installing Erlang
Extract the ERLANG file
cd to source folder
run $ configure
run $ make
Open Makefile and change /Users/deepkrish/Application/erlang to a suitable directory
The line you are looking for is the below:
# prefix from configure, default is /usr/local (must be an absolute path) prefix = /Users/deepkrish/Application/erlang
Run $ make install
Once Erlang is installed non root user add the erlang/bin to PATH in .bash_profile like below:
export ERLANG=”/Users/deepkrish/Application/erlang/bin”
export PATH=${ERLANG}:${PATH}
Now execute the profile by running `$ source .bash_profile” or log off and login again.
Check $ erl -version This should give you the below:
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4
Installing RabbitMQ
Untar the RabbitMQ.tar file and $ cd to the extracted folder
run $ make
2. This should create a scripts folder. Now change into that. $ cd scripts
Now change the below in the rabbitmq-defaults file. This will change where we run and log rabbitMQ. You can change it to the folder you want to run RabbitMQ from as below
### next line potentially updated in package install steps SYS_PREFIX=~/Application/RabbitMQ
Save and close the file
Now create a directory mkdir -p ../etc/rabbitmq Note that if you don't have access to the /etc directory you can also change it to somewhere else.
./rabbitmq-plugins enable rabbitmq_management
Start rabbitmq server $ ./rabbitmq-server &
I use the below script file to start RabbitMQ server whenever I log on.
#!/bin/sh
cd /home/myusername/myproject/RabbitMQ/rabbitmq-server-3.2.3/scripts
export ERLANG="/home/myusername/myproject/RabbitMQ/erlang/bin"
export PATH=${ERLANG}:${PATH}
./rabbitmq-server &
We're trying to use oprofile to track down performance problems on a server cluster. However, the servers in question have a read-only file system, where /var/tmp is the only writeable directory.
OProfile wants to create two directories whenever it runs: /root/.oprofile and /var/lib/oprofile, but it can't, because the filesystem is read-only. I can use the --session-dir command line option to make it write its logs to elsewhere than /var/lib, but I can't find any such option to make it use some other directory than /root/.oprofile.
The filesystem is read-only because it is on nonwriteable media, not because of permissions -- ie, not even superuser can write to those directories. We can cook a new ROM image of the filesystem (which is how we installed oprofile, obviously), but there is no way for a runtime program to write to /root, whether it is superuser or not.
I tried creating a symlink in the ROM that points /root/.oprofile -> /var/tmp/oprofile, but apparently oprofile doesn't see this symlink as a directory, and fails when run:
redacted#redacted:~$ sudo opcontrol --no-vmlinux --start --session-dir=/var/tmp/oprofile/foo
mkdir: cannot create directory `/root/.oprofile': File exists
Couldn't mkdir -p /root/.oprofile
We must run our profilers on this particular system, because the performance issues we're trying to investigate don't manifest if we build and run the app on a development server. We can't just run our tests on a programmer's workstation and profile the app there, because the problem doesn't happen there.
Is there some way to configure oprofile so that it doesn't use /root ?
I guess it should be as simple as overriding the HOME environment variable:
HOME=/tmp/fakehome sudo -E opcontrol --no-vmlinux --start --session-dir=/var/tmp/oprofile/foo
If that doesn't work out, you could have a look at
unionfs
aufs
to create a writable overlay. You might even just mount tmpfs on /root,or something simple like that.
It turns out that this directory is hardcoded into the opcontrol bash script:
# location for daemon setup information
SETUP_DIR="/root/.oprofile"
SETUP_FILE="$SETUP_DIR/daemonrc"
Editing those lines seemed to get it working, more or less.