Problem with Enterprise Search Service

Hi,

we are trying to install enterprise search as a service.

We have configured the enterprise-search.yml configuration file as needed and are able to start the component as a process.
However, when we try to start the service with the same user used to start the process, we get the following error:

--

mkdir: cannot create directory ‘log’: Permission denied

--

We tried starting the service in two different modes: systemctl and init.d, with both we get the same error, despite giving the logs folder the necessary permissions.

Below are the two files used to configure the services:
systemctl
[Unit]
Description=Enterprise Search
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=elastic
Group=elastic

ExecStart=/bin/bash /home/elastic/enterprisesearch/enterprise-search-8.12.1/bin/enterprise-search

StandardOutput=journal
StandardError=inherit

LimitNOFILE=65536
LimitMEMLOCK=infinity
TimeoutStopSec=0
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

init.d
#!/bin/bash
#/etc/init.d/enterprise

DESC="Enterprise Search"
DAEMON=/home/elastic/enterprisesearch/enterprise-search-8.12.1/bin/enterprise-search
DAEMON_ARGS=""
PIDFILE=/var/run/enterprise.pid
LOGFILE=/var/log/enterprise-search.log
USER=elastic
GROUP=elastic

start() {
echo "Starting $DESC"
if [ -f "$PIDFILE" ]; then
echo "$DESC is already running."
exit 1
fi
su -s /bin/bash -c "$DAEMON $DAEMON_ARGS > $LOGFILE 2>&1" $USER &
echo $! > $PIDFILE
}

stop() {
echo "Stopping $DESC"
if [ ! -f "$PIDFILE" ]; then
echo "$DESC is not running."
exit 1
fi
kill $(cat $PIDFILE)
rm $PIDFILE
}

status() {
if [ -f "$PIDFILE" ]; then
echo "$DESC is running, pid $(cat $PIDFILE)"
else
echo "$DESC is not running"
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

exit 0

Can you help me figure out where the problem is?
Consider that we tested on AMI LINUX2/RHEL 8/9 and with all of them we get the same problem. SELinux is disabled.

Best regards,
Federica

If I had to guess, you're making an assumption here about which log folder, and what the necessary permissions are.

From your pasted configs, I infer that you've unpacked the tarball at /home/elastic/enterprisesearch/enterprise-search-8.12.1. Can you do a:

ls -lah /home/elastic/enterprisesearch/enterprise-search-8.12.1/

and share the results?

Sean,

Thank you very much for the reply.

We solved the problem: it was related to the 'JAVA_GC_LOG_DIR' property in 'config/env.sh'. This property must be uncommented and configured with a path to the GC logs.

Kind regards,
Federica

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.