Skip to content

Automaxprocs library prints log in a different format then the rest of the KEDA operator #5970

@zachgilbert-upwork

Description

@zachgilbert-upwork

Report

With the addition of the automaxprocs package to set GOMAXPROCS (#4999), the KEDA operator now prints one console type log on startup, then switches to the format configured by logging.operator.format:

2024/07/18 20:58:55 maxprocs: Updating GOMAXPROCS=1: determined from CPU quota
2024-07-18T20:58:57.052292080Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Starting manager"}
2024-07-18T20:58:57.052312817Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"KEDA Version: 2.13.1"}
{"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Git Commit: 41dd7a8558fdb274f2c0861f6c6d1eba01f2dcd5"}
2024-07-18T20:58:57.052319615Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Go Version: go1.21.6"}
2024-07-18T20:58:57.052321484Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Go OS/Arch: linux/amd64"}
2024-07-18T20:58:57.052323828Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Running on Kubernetes 1.29+","version":"v1.29.4-eks-036c24b"}
2024-07-18T20:58:57.153119735Z I0718 20:58:57.153022       1 leaderelection.go:250] attempting to acquire leader lease h6m-core-keda/operator.keda.sh...
2024-07-18T20:58:57.153330709Z {"level":"info","ts":"2024-07-18T20:58:57Z","msg":"starting server","kind":"health probe","addr":"[::]:8081"}

We are running KEDA in an environment where this is breaking our log ingestion, as we expect only one log format. The way to disable this logging, or implement it with the same logger as the rest app, is documented here: uber-go/automaxprocs#18.

Expected Behavior

When setting the logging.operator.format to json, I expect all logs produced by the KEDA operator to be in JSON format.

Actual Behavior

When running KEDA operator, there is one log printed by the automaxprocs package that doesn't respect the format as configured by the user.

Steps to Reproduce the Problem

  1. Run KEDA Operator
  2. Observe logs

Logs from KEDA operator

2024/07/18 20:58:55 maxprocs: Updating GOMAXPROCS=1: determined from CPU quota
2024-07-18T20:58:57.052292080Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Starting manager"}
2024-07-18T20:58:57.052312817Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"KEDA Version: 2.13.1"}
{"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Git Commit: 41dd7a8558fdb274f2c0861f6c6d1eba01f2dcd5"}
2024-07-18T20:58:57.052319615Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Go Version: go1.21.6"}
2024-07-18T20:58:57.052321484Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Go OS/Arch: linux/amd64"}
2024-07-18T20:58:57.052323828Z {"level":"info","ts":"2024-07-18T20:58:57Z","logger":"setup","msg":"Running on Kubernetes 1.29+","version":"v1.29.4-eks-036c24b"}
2024-07-18T20:58:57.153119735Z I0718 20:58:57.153022       1 leaderelection.go:250] attempting to acquire leader lease h6m-core-keda/operator.keda.sh...
2024-07-18T20:58:57.153330709Z {"level":"info","ts":"2024-07-18T20:58:57Z","msg":"starting server","kind":"health probe","addr":"[::]:8081"}

KEDA Version

2.13.1

Kubernetes Version

1.29

Platform

Amazon Web Services

Scaler Details

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedLooking for support from community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions