Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus could not log to syslog #4420

Open
veksh opened this Issue Jul 25, 2018 · 11 comments

Comments

Projects
None yet
7 participants
@veksh
Copy link

veksh commented Jul 25, 2018

Prometheus 2.3.2 lost an option for syslog logging (it was looking like
--log.format=logger:syslog?appname=prometheus&local=5), and now has only --log.level
and stderr logging.

@krasi-georgiev

This comment has been minimized.

Copy link
Member

krasi-georgiev commented Jul 26, 2018

Which was the last version this worked on?
Prometheus switched logging packages few versions back.

@veksh

This comment has been minimized.

Copy link
Author

veksh commented Jul 26, 2018

Cannot remember exact version (log.format=logger.syslog is still OK with e.g. node_exporter). So this change is intentional? It is a pity then, having syslog was great for general troubleshooting. Some operational and configuration errors are hard to catch w/o logs (e.g. rule evaluation errors).

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Jul 26, 2018

The flag has been dropped since 2.0.0 (see #3219). There's prometheus/common#136 to add JSON logging to the common log library and eventually to Prometheus. Once that's in, it might be possible to enable back Syslog (no commitment though).

@veksh

This comment has been minimized.

Copy link
Author

veksh commented Jul 26, 2018

JSON would be nice too, but it is syslog that I miss. For systemd-based Linux that is less of an issue, but for other platforms there is no options to catch Prometheus messages except redirecting stdout to a file, which is a bit less flexible than standard syslog.

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Jul 26, 2018

redirecting stdout to a file, which is a bit less flexible than standard syslog.

Agreed. What I wanted to say is that adding JSON logging will bring back the log.format flag. Since the underlying log library already supports Syslog, it shouldn't be too complicated to put it back. Again just my thoughts.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jul 26, 2018

The decision thus far is that supporting stdout is sufficient, as the user can then hook that in however they like whether that be syslog or something else.

@ramato-procon

This comment has been minimized.

Copy link

ramato-procon commented Jul 31, 2018

currently logs are written to a log file in /tmp folder additionally. Writing logs to /tmp in a docker container is an antipattern IMHO. Therefore there should be an option to disable file logging at all.
JSON logging is a must for ELK stack.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jul 31, 2018

Prometheus does not write logs to a file, only to stdout. It is something in your setup that is doing that.

@ramato-procon

This comment has been minimized.

Copy link

ramato-procon commented Aug 1, 2018

Yes, you're right. The logs were created by OpenShift. Excuse me.

Nevertheless JSON logging is needed for ELK.

@ntindall

This comment has been minimized.

Copy link

ntindall commented Aug 9, 2018

I wrote this to convert logfmt to json .... https://github.com/ntindall/logfmt2json
but can we just merge prometheus/common#136 to bring back the json support?

@dlazerka

This comment has been minimized.

Copy link

dlazerka commented Sep 25, 2018

@brian-brazil

Prometheus does not write logs to a file, only to stdout.

Actually, prometheus 2.2.1 writes to STDERR, not STDOUT. How to make it write to stdout when I don't have shell access? E.g. I'm running official vanilla prom/prometheus docker image on k8s. And by default, my logging collectors mark all the normal logs as errors because STDERR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.