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

Add support for log.level in config/environment #3384

Closed
dsvensson opened this Issue Oct 31, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@dsvensson
Copy link

dsvensson commented Oct 31, 2017

What did you do?

Started prometheus under docker-compose.

What did you expect to see?

Nothing.

What did you see instead? Under which circumstances?

Lots of log INFO's that I want to hide.

Environment

prom/prometheus docker container.

  • System information:

    docker

  • Prometheus version:

    2.0.0-rc2

  • Logs:

prometheus_1  | level=info ts=2017-10-31T22:19:06.761671514Z caller=main.go:215 msg="Starting Prometheus" version="(version=2.0.0-rc.2, branch=master, revision=3701a827cf5da595bd2366dad6e1b3c979a1009c)"

Turns out Prometheus doesn't support setting log.level in the config file, which requires copying the whole ENTRYPOINT/CMD from the prom/prometheus Dockerfile:

ENTRYPOINT [ "/bin/prometheus" ]
CMD        [ "--config.file=/etc/prometheus/prometheus.yml", \
             "--storage.tsdb.path=/prometheus", \
             "--web.console.libraries=/usr/share/prometheus/console_libraries", \
             "--web.console.templates=/usr/share/prometheus/consoles" ]

...and pasteing into docker-compose.yml, with --log.level=warn added:

    prometheus:
      image: prom/prometheus:master
      entrypoint:
        - "/bin/prometheus"
        - "--log.level=warn"
        - "--config.file=/etc/prometheus/prometheus.yml"
        - "--storage.tsdb.path=/prometheus"
        - "--web.console.libraries=/usr/share/prometheus/console_libraries"
        - "--web.console.templates=/usr/share/prometheus/consoles"
      volumes:
        - ./prometheus.yml:/etc/prometheus/prometheus.yml

Ideally this would be possible to either override via environment variables, or the config file.

Here is how log.level can be overridden for Grafana in docker-compose.yml:


    grafana:
      image: grafana/grafana
      environment:
        GF_LOG_CONSOLE_LEVEL: warn
      depends_on:
        - prometheus
      links:
        - prometheus
      ports:
        - 3000:3000

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 31, 2017

For Prometheus we only offer one way to configure a given option to keep things simple. It is presumed that you have a configuration management system which handles things like this, and multiple configuration sources with potentially conflicting information does not help you.

@dsvensson

This comment has been minimized.

Copy link
Author

dsvensson commented Oct 31, 2017

No need to change Prometheus. This can be handled via a wrapper script in the default Dockerfile.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 31, 2017

If you want a wrapper, you can add it within your own configuration management setup.

@dsvensson

This comment has been minimized.

Copy link
Author

dsvensson commented Oct 31, 2017

Yes, ofc, but that would benefit few. I filed #3385 instead that leaves out any Prometheus modifications.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

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