logs for Prometheus and Alertmanager

28 views
Skip to first unread message

rs vas

unread,
Feb 24, 2020, 5:02:37 PM2/24/20
to Prometheus Users
How to configure Prometheus and Alertmanager write logs into a file?


Thank!
Vas

Christian Hoffmann

unread,
Feb 24, 2020, 5:12:41 PM2/24/20
to rs vas, Prometheus Users
Hi,
Those binaries log to stderr, as do many other modern services.

The usual setup consists of running Prometheus via some service
supervisor (e.g. systemd) or container runtime (Docker).
Those systems usually support a way to capture those standardized logs
and forward them to some place of your liking (e.g. systemd's journald,
syslog, etc.).

How is Prometheus started in your case?

Kind regards,
Christian

rs vas

unread,
Feb 24, 2020, 5:20:33 PM2/24/20
to Prometheus Users
using systemd as a service.

rs vas

unread,
Feb 24, 2020, 5:26:20 PM2/24/20
to Prometheus Users
Thanks Chris,
it is like configure as part of the service configuration?
StandardOutput=/var/log/log1.log
StandardError=/var/log/log2.log

Julien Pivotto

unread,
Feb 24, 2020, 5:29:24 PM2/24/20
to rs vas, Prometheus Users
On 24 Feb 14:26, rs vas wrote:
> Thanks Chris,
> it is like configure as part of the service configuration?
>
> StandardOutput=/var/log/log1.log
> StandardError=/var/log/log2.log

It would be better to use journald, as the StandardError= might end up
in an ever growing file that would be erased on each service restart.

Prometheus does not use StandardOutput for its logs.

>
>
> On Monday, February 24, 2020 at 3:20:33 PM UTC-7, rs vas wrote:
> >
> > using systemd as a service.
> >
> > On Monday, February 24, 2020 at 3:12:41 PM UTC-7, Christian Hoffmann wrote:
> >>
> >> Hi,
> >>
> >> On 2/24/20 11:02 PM, rs vas wrote:
> >> > How to configure Prometheus and Alertmanager write logs into a file?
> >> >
> >> > I could not find any thing as argument to pass
> >> >
> >> https://github.com/prometheus/alertmanager/blob/master/cmd/alertmanager/main.go#L186
> >> Those binaries log to stderr, as do many other modern services.
> >>
> >> The usual setup consists of running Prometheus via some service
> >> supervisor (e.g. systemd) or container runtime (Docker).
> >> Those systems usually support a way to capture those standardized logs
> >> and forward them to some place of your liking (e.g. systemd's journald,
> >> syslog, etc.).
> >>
> >> How is Prometheus started in your case?
> >>
> >> Kind regards,
> >> Christian
> >>
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/85aac663-04d6-4d19-909b-7a76ae78de0f%40googlegroups.com.


--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc
Reply all
Reply to author
Forward
0 new messages