I installed Elasticsearch on CentOS using
rpm and am encountering this error when I try to start it via
systemctl start elasticsearch:
Feb 20 21:08:34 server.cberdata.org systemd: Started Elasticsearch. Feb 20 21:08:34 server.cberdata.org elasticsearch: OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied Feb 20 21:08:51 server.cberdata.org systemd: elasticsearch.service: main process exited, code=exited, status=78/n/a Feb 20 21:08:51 server.cberdata.org systemd: Unit elasticsearch.service entered failed state. Feb 20 21:08:51 server.cberdata.org systemd: elasticsearch.service failed.
Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
drwxr-xr-x 21 root root 4096 Feb 11 19:10 var
drwxrwxr-- 12 root root 4096 Feb 20 21:00 log
drwxrwxrwx 2 elasticsearch elasticsearch 4096 Feb 20 20:56 elasticsearch
(which I manually created to see if that would help, but doing so had no effect on the error):
-rwxrwxrwx 1 elasticsearch elasticsearch 0 Feb 20 20:56 gc.log
/var/log permissions to
drwxrwxrwx appears to fix the problem, but I'm hesitant to do that because it seems insecure and it results in these new errors:
/etc/cron.daily/logrotate: error: skipping "/var/log/exim_mainlog" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
Am I correct that
systemd is running this service as the
elasticsearch user? If it's doing that, how can the owner of the file and its directory, with apparent read/write/execute permissions, not have permission to open that file?