Logs for prometheus

8,316 views
Skip to first unread message

pankaj...@gmail.com

unread,
Jun 11, 2018, 6:11:32 AM6/11/18
to Prometheus Users
Hi,

I have installed non-containerized version of Prometheus, can someone please point out that by default where the logs are generated for Prometheus?

Regards,
Pankaj Jain.

Shankar Bala

unread,
Jun 11, 2018, 12:41:50 PM6/11/18
to pankaj...@gmail.com, promethe...@googlegroups.com
Hi

If you do prometheus -h --u will see an option to set the logging...
or simply send stdout as below 

/path/to/prometheus 2> path/to/your/log/file.log

shan

--
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 post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/05da56ec-9af9-49d9-9c21-893c61776665%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pankaj...@gmail.com

unread,
Jun 12, 2018, 12:30:00 PM6/12/18
to Prometheus Users
There were no options with --u, following options are shown:

Flags:
  -h, --help                     Show context-sensitive help (also try --help-long and --help-man).
      --version                  Show application version.
      --config.file="prometheus.yml"
                                 Prometheus configuration file path.
      --web.listen-address="0.0.0.0:9090"
                                 Address to listen on for UI, API, and telemetry.
      --web.read-timeout=5m      Maximum duration before timing out read of the request, and closing idle connections.
      --web.max-connections=512  Maximum number of simultaneous connections.
      --web.external-url=<URL>   The URL under which Prometheus is externally reachable (for example, if Prometheus is served via a reverse proxy). Used for
                                 generating relative and absolute links back to Prometheus itself. If the URL has a path portion, it will be used to prefix
                                 all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically.
      --web.route-prefix=<path>  Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.
      --web.user-assets=<path>   Path to static asset directory, available at /user.
      --web.enable-lifecycle     Enable shutdown and reload via HTTP request.
      --web.enable-admin-api     Enables API endpoints for admin control actions.
      --web.console.templates="consoles"
                                 Path to the console template directory, available at /consoles.
      --web.console.libraries="console_libraries"
                                 Path to the console library directory.
      --storage.tsdb.path="data/"
                                 Base path for metrics storage.
      --storage.tsdb.min-block-duration=2h
                                 Minimum duration of a data block before being persisted.
      --storage.tsdb.max-block-duration=<duration>
                                 Maximum duration compacted blocks may span. (Defaults to 10% of the retention period)
      --storage.tsdb.retention=15d
                                 How long to retain samples in the storage.
      --storage.tsdb.no-lockfile
                                 Do not create lockfile in data directory.
      --alertmanager.notification-queue-capacity=10000
                                 The capacity of the queue for pending alert manager notifications.
      --alertmanager.timeout=10s
                                 Timeout for sending alerts to Alertmanager.
      --query.lookback-delta=5m  The delta difference allowed for retrieving metrics during expression evaluations.
      --query.timeout=2m         Maximum time a query may take before being aborted.
      --query.max-concurrency=20
                                 Maximum number of queries executed concurrently.
      --log.level=info           Only log messages with the given severity or above. One of: [debug, info, warn, error]

I would also like to know if we do not set it explicitly then there must be some default location where prometheus set the logs.

Regards,
Pankaj.

Ben Kochie

unread,
Jun 12, 2018, 1:01:39 PM6/12/18
to Pankaj Jain, Prometheus Users
Prometheus logs only to STDERR.

Chi Thu Le

unread,
Jun 12, 2018, 4:15:31 PM6/12/18
to Prometheus Users
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CABbyFmppS2Fe%2BwWW6FuVnvz2K%3Dk5DFKkgJDW3e50YisZix5ObA%40mail.gmail.com.

pankaj...@gmail.com

unread,
Jun 19, 2018, 1:25:02 AM6/19/18
to Prometheus Users
Does you mean to say prometheus do not generate any logs, moreover when I tried to use the option -h --u it gives me an error:

prometheus -h --u
Error parsing commandline arguments: unknown long flag '--u'
prometheus: error: unknown long flag '--u'

I want to set a path for log file along with other options which we can pass when we start prometheus (for example --config.file) so that I can trace all logs generated by prometheus.

Regards,
Pankaj.

Callum Styan

unread,
Jun 20, 2018, 4:53:12 PM6/20/18
to Prometheus Users
Does you mean to say prometheus do not generate any logs
Yes, Prometheus itself does not log to a file. It only logs to STDERR, as Ben said.

It's up to you as a user to decide where you want the logs via redirecting, or if you're running via something like docker to have something collect the logs from the container.

pankaj...@gmail.com

unread,
Jun 22, 2018, 2:38:55 AM6/22/18
to Prometheus Users
If this is case then what is the purpose of setting the flag:

 --log.level

for which logs it sets it to INFO, Warning or from many other options available.

I understand that logs are useful not only for traversing in debugging error but also in case we would like to traverse a successful workflow, the purpose of logs is to see that what all modules have been executed inside the application irrespective of the fact that whether it was successful or a failed scenario.

Regards,
Pankaj.

Callum Styan

unread,
Jun 22, 2018, 1:02:12 PM6/22/18
to Prometheus Users
It's not necessary to log to file in order to change the log level of an application. You can make the output more verbose, but Prometheus itself will still just output to stderr. It's up to you to decide what to do with that output.
Reply all
Reply to author
Forward
0 new messages