Update: With the 19.216-33 version of the Collector, released May 1, 2018, a systemd entry should be added automatically at install time.
When a Collector installs, it tries to auto-detect which startup system to use. The wrapper script will try to detect systemd by looking for the following:
- Ensure directory "/etc/systemd" exists (ls /etc/systemd)
- Ensure either of these files exists: "/bin/pidof" OR "/usr/sbin/pidof"
- Use that file to check for systemd running, e.g. "/bin/pidof systemd" OR "/usr/sbin/pidof systemd"
If the above checks true, then the Collector will create the systemd startup scripts, otherwise, it will fall back to the init.d startup scripts.
If the Collector defaults to the init.d startup scripts, it is possible that systemd is not yet running on the host server. This can happen when using scripts to deploy Linux images with the Collector, such as when bootstrapping Linux instances with the Collector. This can result in a race condition that gets the Collector installed before systemd is ready. To avoid this, you can simply add a "sleep" parameter to your deployment script to delay the Collector installation for a few seconds or, if you are installing more that one application, you can move the Collector installation to the bottom of your application list.
How to manually create a systemd startup script
After the installation of the Collector via RPM, Deb, .tar or .sh scripts you can manually create a systemd start script (sumologic.service) to start the Collector at boot time. Below is a template used to create this service script. You just need to place this within "/usr/lib/systemd/system" directory and then set the script to be executable.
Description=Sumo Logic Collector
# Give a reasonable amount of time for the server to start up/shut down
Once you have the file in place kill any running Collector process on the host and then run the following command.
sudo systemctl enable sumologic.service
You can then start/stop/restart the service with the following commands.
sudo systemctl stop sumologic.service
sudo systemctl start sumologic.service