Elasticsearch can't write to log files

后端 未结 11 1669
既然无缘
既然无缘 2021-02-01 02:00

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 !

相关标签:
11条回答
  • 2021-02-01 02:28

    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.

    0 讨论(0)
  • 2021-02-01 02:28

    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/

    0 讨论(0)
  • 2021-02-01 02:29

    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.

    0 讨论(0)
  • 2021-02-01 02:35

    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:

    1. It looks like you installed elastic search using yum or apt-get or else you would have had the 'config' directory under ES_HOME.

    2. 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

    3. So, all the variables are properly initialized and then passed as command line parameters.

    4. So, the best way for you to start is using the service:

      >sudo service elasticsearch start

    5. It will make sure that all the config and log parameters are passed to the main command.

    6. Check logs under /var/log/$NAME that would be '/var/log/elasticsearch`

    0 讨论(0)
  • 2021-02-01 02:37

    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

    0 讨论(0)
提交回复
热议问题