Skip to content
New issue

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

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

Already on GitHub? # to your account

Dex server not using structured/json logging consistently with --logformat json #13191

Closed
3 tasks done
kaiburjack opened this issue Apr 11, 2023 · 2 comments · Fixed by #19608
Closed
3 tasks done

Dex server not using structured/json logging consistently with --logformat json #13191

kaiburjack opened this issue Apr 11, 2023 · 2 comments · Fixed by #19608
Assignees
Labels
bug Something isn't working

Comments

@kaiburjack
Copy link

kaiburjack commented Apr 11, 2023

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When starting the argocd-dex executable with --logformat json, then some log outputs are structured/json, while others are not.
In our particular setup, we use the Argo CD Helm chart in version 5.28.1 and supply the --logformat json via the dex.extraArgs Helm value and a ps inside of the pod confirms that the argocd-dex executable was started accordingly as /shared/argocd-dex rundex --logformat json.

We are currently going over all our logs that are erroneously categorized as "errors" by fluentbit/Stackdriver in GCP/GKE, just because they emit log lines in non-json format on stderr. For this, all log output should use structured/json logging.

The log output produced by this is seen below in the "Logs" section. Notably, it contains both structured log output as well as text output. The latter is likely produced by the spawned/started dex executable.

It would be nice if using --logformat json also applies to the started dex program (somehow).

To Reproduce

  • start the argocd-dex component using rundex --logformat json
  • observe that some log outputs are structured/json while others are not

Expected behavior

All log messages output by argocd-dex (and sub-processes started by it, notably the dex executable) should use structured/json logging consistently such that those log lines can be identified and classified correctly by other external tools like a GCP/GKE-provided fluentbit Log Agent.

Version

argocd: v2.6.7+5bcd846
  BuildDate: 2023-03-23T14:57:27Z
  GitCommit: 5bcd846fa16e4b19d8f477de7da50ec0aef320e5
  GitTreeState: clean
  GoVersion: go1.18.10
  Compiler: gc
  Platform: linux/amd64
FATA[0000] Argo CD server address unspecified 

Logs

{"built":"2023-03-23T14:57:27Z","commit":"5bcd846fa16e4b19d8f477de7da50ec0aef320e5","level":"info","msg":"ArgoCD Dex Server is starting","namespace":"argocd","time":"2023-04-11T13:20:40Z","version":"v2.6.7+5bcd846"}
{"level":"info","msg":"Generating self-signed TLS certificate for this session","time":"2023-04-11T13:20:40Z"}
{"level":"info","msg":"Starting configmap/secret informers","time":"2023-04-11T13:20:40Z"}
{"level":"info","msg":"Configmap/secret informer synced","time":"2023-04-11T13:20:40Z"}
{"level":"info","msg":"0xc00034c780 subscribed to settings updates","time":"2023-04-11T13:20:40Z"}
time="2023-04-11T13:20:40Z" level=info msg="Dex Version: v2.35.3-dirty, Go Version: go1.19.2, Go OS/ARCH: linux amd64"
time="2023-04-11T13:20:40Z" level=info msg="config issuer: https://argocd.<redacted>/api/dex"
time="2023-04-11T13:20:40Z" level=info msg="config storage: memory"
time="2023-04-11T13:20:40Z" level=info msg="config static client: Argo CD"
time="2023-04-11T13:20:40Z" level=info msg="config static client: Argo CD CLI"
time="2023-04-11T13:20:40Z" level=info msg="config connector: google"
time="2023-04-11T13:20:40Z" level=info msg="config skipping approval screen"
time="2023-04-11T13:20:40Z" level=info msg="config refresh tokens rotation enabled: true"
time="2023-04-11T13:20:40Z" level=info msg="keys expired, rotating"
time="2023-04-11T13:20:41Z" level=info msg="keys rotated, next rotation: 2023-04-11 19:20:41.062843144 +0000 UTC"
time="2023-04-11T13:20:41Z" level=info msg="listening (telemetry) on 0.0.0.0:5558"
@kaiburjack kaiburjack added the bug Something isn't working label Apr 11, 2023
@riteshnanda09
Copy link

riteshnanda09 commented Apr 20, 2023

Those logs in text format are from identity service dexidp/dex . Looking at code looks logging flags from argocd-dex executable are not passed to dex server, but config for dex server can be specified in configmap argocd-cm in dex.config object.

dex.config: |
    logger:
      level: debug
      format: json
    connectors:
      - type: saml
     ...

@nlamirault
Copy link

confirmed it works fine as @riteshnanda09 said.

@agaudreault agaudreault self-assigned this Aug 20, 2024
jannfis pushed a commit that referenced this issue Aug 21, 2024
* feat(dex): set logger based on argo config

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* add env config

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* organize import bug?

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

---------

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
pasha-codefresh pushed a commit to pasha-codefresh/argo-cd that referenced this issue Oct 9, 2024
…#19608)

* feat(dex): set logger based on argo config

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* add env config

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* organize import bug?

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

---------

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants