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

Service not honoring --log.format flag #525

Closed
fede843 opened this issue Oct 17, 2023 · 2 comments · Fixed by #526
Closed

Service not honoring --log.format flag #525

fede843 opened this issue Oct 17, 2023 · 2 comments · Fixed by #526

Comments

@fede843
Copy link

fede843 commented Oct 17, 2023

Describe the bug
Service not honoring --log.format flag

To reproduce
Steps to reproduce the behavior:
Using docker compose:

version: '3.9'
services:
  nginx-exporter:
    image: nginx/nginx-prometheus-exporter:edge
#    image: nginx/nginx-prometheus-exporter:latest
    container_name: nginx-exporter
    hostname: nginx-exporter
    restart: always
    labels:
      - prometheus_job=nginx
      - prometheus_metrics_port=9113
#      - prometheus_metrics_path=/metrics
    command:
      - '--nginx.scrape-uri=http://nginx:81/nginx_status'
      - '--log.level=info'
      - '--log.format=json'
    networks:
      - mainnet
#    ports:
#      - 9113:9113

Logs are showing as:

level=info ts=2023-10-17T12:53:40.498Z caller=exporter.go:118 msg="Starting nginx-prometheus-exporter" version="(version=edge, branch=main, revision=b342fe37626c8c44df0543f1b619aec8272efb10)"
level=info ts=2023-10-17T12:53:40.498Z caller=exporter.go:119 msg="Build context" build_context="(go=go1.19.13, platform=linux/amd64, user=goreleaser, date=2023-10-12T10:10:21Z, tags=unknown)"
level=info ts=2023-10-17T12:53:40.498Z caller=tls_config.go:274 msg="Listening on" address=[::]:9113
level=info ts=2023-10-17T12:53:40.498Z caller=tls_config.go:277 msg="TLS is disabled." http2=false address=[::]:9113

Expected behavior

Logs should be json, and not logfmt.

Your environment

  • Version: docker edge revision=b342fe37626c8c44df0543f1b619aec8272efb10
  • Docker 24.0.5-ce
  • NGINX 1.25.2 (docker)
@lucacome lucacome mentioned this issue Oct 18, 2023
@lucacome
Copy link
Member

Thanks @fede843 for catching this! I've opened a PR to fix it.

@fede843
Copy link
Author

fede843 commented Jan 29, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants