I would like to activate logs of elasticsearch .
When I run elasticsearch binaries, I realize that I have problems with logging : the configuration cannot be loaded !
Your elasticsearch.yml
file as well as logging.yml
file will be in the /etc/elasticsearch
folder.
Create a config folder in your elasticsearch
folder in /usr/share
and move the .yml files to the config folder
Now run /bin/elasticsearch start
and it will work.
You can do symlinks, but if you simply want to point elasticsearch to the desired config directory, you can use the following:
/usr/share/elasticsearch/bin/elasticsearch --default.path.conf=/etc/elasticsearch/
I'm running elasicsearch with the user elasticsearch
, so I used this command:
sudo su elasticsearch -c './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch'
from the dir where elasticsearch is installed. Had to do:
sudo chown -R elasticsearch:elasticsearch .
in there though because otherwise it won't have write access to the log files. I don't know how this would work via the debian startup scripts, but this seems to work fine like this.
I got into the same issue and was wondering how they could miss it in the installation script of elastic search. So, after some digging here is what I found:
It looks like you installed elastic search using yum or apt-get or else you would have had the 'config' directory under ES_HOME.
Checking the init.d/elasticsearch shows the following:
DAEMON_OPTS="-d -p $PID_FILE --default.path.home=$ES_HOME --default.path.logs=$LOG_DIR --default.path.data=$DATA_DIR --default.path.conf=$CONF_DIR"
:
# Start Daemon
start-stop-daemon -d $ES_HOME --start -b --user "$ES_USER" -c "$ES_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
So, all the variables are properly initialized and then passed as command line parameters.
So, the best way for you to start is using the service:
>sudo service elasticsearch start
It will make sure that all the config and log parameters are passed to the main command.
Check logs under /var/log/$NAME
that would be '/var/log/elasticsearch`
Following this worked for me.
Your elasticsearch.yml file as well as logging.yml file will be in the /etc/elasticsearch folder.
Create a config folder in your elasticsearch folder in /usr/share and move the .yml files to the config folder