Elasticsearch unable to start

Hello,
I am not able to start the elasticsearch 1.4.5 in linux. i get the below error.

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/log/elasticsearch/elasticsearch.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:142)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
log4j:ERROR Either File or DatePattern options are not set for appender [file].
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/log/elasticsearch/elasticsearch_index_indexing_slowlog.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:142)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:672)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:516)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
log4j:ERROR Either File or DatePattern options are not set for appender [index_indexing_slow_log_file].
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/log/elasticsearch/elasticsearch_index_search_slowlog.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:142)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:672)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:516)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
log4j:ERROR Either File or DatePattern options are not set for appender [index_search_slow_log_file].

Any help ?

It seems like Elasticsearch does not have write permissions to its log directory. Can you verify that the user you are running Elasticsearch under have access to that directory?

Hello,
I missed to add tthis info in my first post.

There is no permission issue. I am running as root user and have got full rights to all thos folders.

How did you install Elasticsearch? Using the tar.gz/zip, the deb or the rpm?

Also what command are you running to start Elasticsearch?

I ask because if you install Elasticsearch using the rpm or the deb and start it as a service then it will probably be running as a user called 'elasticsearch' as the deb/rpm both create a dedicated user to run Elasticsearch. If this is the case it will be throwing the error because the 'elasticsearch' user does not have access to /var/log/elasticsearch/elasticsearch_index_indexing_slowlog.log

1 Like

i followed the below steps to install .

  1. vi /etc/yum.repos.d/elasticsearch.repo

[elasticsearch-1.4]
name=Elasticsearch repository for 1.4.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.4/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1

  1. yum install elasticsearch

i start elasticsearch like - " service elasticsearch start "

Ok so that will have installed the rpm package for Elasticsearch. It will have created an elasticsearch user on your linux OS and when you start the Elasticsearch service it will be running as the elasticsearch user. The problem you are encountering will be that the elasticsearch user does not have permission to write to /var/log/elasticsearch or the files inside it.

1 Like

thanks for the info.. it worked now.. after giving the write permission to the folder :smile:

Neetal how did you resolved this issue? can you let me know the commands used?

2 Likes

I'm confused. I had elasticsearch running fine. Then after reboot it fails to start. I get errors, but it seems that there is permission issue. I gave /var/log/elasticsearch read/write permissions and it didn't solve the problem. Then I gave /var/log read/write permissions but it still wouldn't start saying permission denied. I'm confused. Any ideas out there?

Thanks

Starting elasticsearch: 2017-01-10 13:42:23,909 main ERROR Unable to create file /var/log/elasticsearch/elasticsearch.log java.io.IOException: Permission denied

@ki_ran, please start a new thread for your unrelated question. (And do read the error message. It's pretty clear on what the problem is.)

1 Like

I have solved bellow issue
main ERROR RollingFileManager (/home/ubuntu/elasticsearch-5.4.1/logs/elasticsearch.log) java.io.FileNotFoundException: /home/ubuntu/elasticsearch-5.4.1/logs/elasticsearch.log (Permission denied) java.io.FileNotFoundException: /home/ubuntu/elasticsearch-5.4.1/logs/elasticsearch.log (Permission denied)

I am running elastic on AWS EC2 and i have loged in through ubuntu user . i am using ubuntu 16.4

The main reason is permission issue

ubuntu@ip-100-310-111-42:~/elasticsearch-5.4.1$ ls -al

total 252
drwxr-xr-x 9 ubuntu ubuntu 4096 Jun 13 21:28 .
drwxr-xr-x 8 ubuntu ubuntu 4096 Jun 20 16:39 ..
drwxr-xr-x 2 ubuntu ubuntu 4096 Jun 13 21:31 bin
drwxr-xr-x 3 ubuntu ubuntu 4096 Jun 13 21:28 config
drwxrwxr-x 3 ubuntu ubuntu 4096 Jun 13 21:28 data
drwxr-xr-x 2 ubuntu ubuntu 4096 May 29 16:08 lib
-rw-r--r-- 1 ubuntu ubuntu 11358 May 29 16:03 LICENSE.txt
drwxrwxr-x 2 ubuntu ubuntu 4096 Jun 21 11:13 logs
drwxr-xr-x 12 ubuntu ubuntu 4096 May 29 16:08 modules
-rw-rw-r-- 1 ubuntu ubuntu 194187 May 29 16:08 NOTICE.txt
drwxr-xr-x 2 ubuntu ubuntu 4096 May 29 16:08 plugins
-rw-r--r-- 1 ubuntu ubuntu 9548 May 29 16:03 README.textile

ubuntu@ip-100-310-111-42:~/elasticsearch-5.4.1$ chmod -R 777 logs/

ubuntu@ip-100-310-111-42:~/elasticsearch-5.4.1$ ls -al
total 252
drwxr-xr-x 9 ubuntu ubuntu 4096 Jun 13 21:28 .
drwxr-xr-x 8 ubuntu ubuntu 4096 Jun 20 16:39 ..
drwxr-xr-x 2 ubuntu ubuntu 4096 Jun 13 21:31 bin
drwxr-xr-x 3 ubuntu ubuntu 4096 Jun 13 21:28 config
drwxrwxr-x 3 ubuntu ubuntu 4096 Jun 13 21:28 data
drwxr-xr-x 2 ubuntu ubuntu 4096 May 29 16:08 lib
-rw-r--r-- 1 ubuntu ubuntu 11358 May 29 16:03 LICENSE.txt
drwxrwxrwx 2 ubuntu ubuntu 4096 Jun 21 11:13 logs
drwxr-xr-x 12 ubuntu ubuntu 4096 May 29 16:08 modules
-rw-rw-r-- 1 ubuntu ubuntu 194187 May 29 16:08 NOTICE.txt
drwxr-xr-x 2 ubuntu ubuntu 4096 May 29 16:08 plugins
-rw-r--r-- 1 ubuntu ubuntu 9548 May 29 16:03 README.textile

Then i have started elasticsearch working fine:slight_smile:

ubuntu@ip-100-310-111-42:~/elasticsearch-5.4.1/bin$ ./elasticsearch -d