0

I have just started playing with prometheus and installed it as a service.

Initially I started it in a screen and let it run but I'd like to run it as a systemd managed service and thus would like to redirect all it's output to a log file however ExecStart=/opt/prometheus/prometheus/prometheus &> /opt/prometheus/prometheus/prometheus.log results in an error, but if I remove the redirection systemd still reports a timeout error but the service is started and running successfully. I did however find this article which is the next best thing I've found thus far but it is not what I want to achieve.

Edit: error message as requested

- Subject: Unit prometheus.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit prometheus.service has begun starting up.
Sep 04 09:14:13 prometheus prometheus[4036]: prometheus: error: unexpected >>
Sep 04 09:14:13 prometheus systemd[1]: prometheus.service: Control process exited, code=exited status=1
Sep 04 09:14:13 prometheus systemd[1]: Failed to start Prometheus monitoring system for monitoring system nodes and services.
-- Subject: Unit prometheus.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit prometheus.service has failed.
--
-- The result is failed.
4
  • This ExecStart= line is from /lib/systemd/system/prometheus.service, isn't it? Did you try to edit it using sudo systemctl edit --full prometheus? Please add the error messages you're receiving in their entirety to your question using a code block ({} button).
    – dessert
    Commented Sep 4, 2017 at 9:10
  • "to a log file" systemd has a log itself called "journal" see freedesktop.org/software/systemd/man/…
    – Rinzwind
    Commented Sep 4, 2017 at 9:16
  • @dessert No I created the service file myself so the path is the path where I installed prometheus, I'll edit to reflect the path and add error message
    – Dark Star1
    Commented Sep 4, 2017 at 9:17
  • @Rinzwind Thanks, but I want to redirect the output to a file. Besides if I start the service without redirection it just reports a timeout error in starting the service
    – Dark Star1
    Commented Sep 4, 2017 at 9:22

0

You must log in to answer this question.

Browse other questions tagged .