Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Support log-level for controller logs #238

Closed
dorroddorrod opened this issue May 23, 2021 · 9 comments · Fixed by #249
Closed

Support log-level for controller logs #238

dorroddorrod opened this issue May 23, 2021 · 9 comments · Fixed by #249
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@dorroddorrod
Copy link

dorroddorrod commented May 23, 2021

@jgwest EDIT:
Enhancement Request:
Add support for configurable log levels via parameter, eg the ability to set additional log levels beyond just the --debug parameter support we have now. For example, as requested, ability to set the log level to only show error or warn.

Original Text from @dorroddorrod
Hi,
Is there any way to control the log level for the application-set controller ?

@jgwest
Copy link
Member

jgwest commented May 24, 2021

Hi @dorroddorrod , you can add --debug parameter to the argocd-applicationset-controller Deployment, eg:
kubectl edit deployment/argocd-applicationset-controller, and add this line:

spec:
  template:
    spec:
      containers:
      - command:
        - applicationset-controller
        - --debug  # <-------- add this

Or you can edit the install.yaml, add the line as above, and reapply using kubectl apply -f install.yaml:
https://github.com/argoproj-labs/applicationset/blob/48a7b47da0552b9e5a518704e25489ab4a36645c/manifests/install.yaml#L3655

@jgwest jgwest added the question Further information is requested label May 24, 2021
@dorroddorrod
Copy link
Author

dorroddorrod commented May 24, 2021

Hi @jgwest
Thanks for your reply
I want to change the log level to warn and not to debug.
Currently the info logs are bombarding our logging database (ES)

@jgwest
Copy link
Member

jgwest commented May 26, 2021

Ah, gotcha, sorry about that 😅, we don't have that currently, and the logs are definitely verbose by default. Let me convert this issue into an enhancement for that.

@jgwest jgwest added enhancement New feature or request and removed question Further information is requested labels May 26, 2021
@jgwest jgwest added this to the Milestone 2 milestone May 26, 2021
@jgwest jgwest added help wanted Extra attention is needed good first issue Good for newcomers labels May 26, 2021
@rumstead
Copy link
Contributor

rumstead commented May 26, 2021

Do we have any thoughts on how this should be implemented? Ie, instead of taking debug argument, accept an arbitrary log level?

Accept 2 for backward compatibility?
Ie, --debug == --loglevel debug
--loglevel info, trace, debug, error

Any suggestions on which info logs should be changed to debug/trace?

I am interested in completing this issue :)

@jgwest
Copy link
Member

jgwest commented May 27, 2021

Awesome, thanks @rumstead.

Exactly as you said, it couldn't hurt to keep --debug for the time being, and add --loglevel (info, trace, debug, error) (just like Argo CD)

Open to suggestions re: which info logs should be downgraded, if they are not providing any value.

@rumstead
Copy link
Contributor

@jgwest feel free to assign to me

@rumstead
Copy link
Contributor

rumstead commented May 27, 2021

Ok, so the majority of the logs are coming from the git clients in ArgoCD.

The git client every time it runs a command -> hits this method -> which captures tracing spans

Since it uses logrus.New(), it gets the default info logs. I am not sure if there is a way to configure this.

@jgwest any comments or suggestions here? You will see very similar logs in the repo-server of ArgoCD.

time="2021-05-27T15:50:30Z" level=info msg="git fetch origin --tags --force" dir="/tmp/my_internal_git_repo" execID=KIlVw
time="2021-05-27T15:50:32Z" level=info msg=Trace args="[git fetch origin --tags --force]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=1769.0971630000001
time="2021-05-27T15:50:32Z" level=info msg="git checkout --force git_sha" dir="/tmp/my_internal_git_repo" execID=AmjdR
time="2021-05-27T15:50:32Z" level=info msg=Trace args="[git checkout --force git_sha]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=4.057425
time="2021-05-27T15:50:32Z" level=info msg="git clean -fdx" dir="/tmp/my_internal_git_repo" execID=x3uMq
time="2021-05-27T15:50:32Z" level=info msg=Trace args="[git clean -fdx]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=2.401413
time="2021-05-27T15:50:32Z" level=info msg="git ls-files --full-name -z -- apps/**/config.json" dir="/tmp/my_internal_git_repo" execID=zeesc
time="2021-05-27T15:50:32Z" level=info msg=Trace args="[git ls-files --full-name -z -- apps/**/config.json]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=1.9009090000000002
time="2021-05-27T15:50:32Z" level=info msg="git fetch origin --tags --force" dir="/tmp/my_internal_git_repo" execID=zsqKe
time="2021-05-27T15:50:33Z" level=info msg=Trace args="[git fetch origin --tags --force]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=390.86078499999996
time="2021-05-27T15:50:33Z" level=info msg="git checkout --force git_sha" dir="/tmp/my_internal_git_repo" execID=Ck9ui
time="2021-05-27T15:50:33Z" level=info msg=Trace args="[git checkout --force git_sha]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=4.16638
time="2021-05-27T15:50:33Z" level=info msg="git clean -fdx" dir="/tmp/my_internal_git_repo" execID=SieSR
time="2021-05-27T15:50:33Z" level=info msg=Trace args="[git clean -fdx]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=2.6018920000000003
time="2021-05-27T15:50:33Z" level=info msg="git fetch origin --tags --force" dir="/tmp/my_internal_git_repo" execID=CZjtN
time="2021-05-27T15:50:35Z" level=info msg=Trace args="[git fetch origin --tags --force]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=1648.057597
time="2021-05-27T15:50:35Z" level=info msg="git checkout --force git_sha" dir="/tmp/my_internal_git_repo" execID=X7MUV
time="2021-05-27T15:50:35Z" level=info msg=Trace args="[git checkout --force git_sha]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=4.729625
time="2021-05-27T15:50:35Z" level=info msg="git clean -fdx" dir="/tmp/my_internal_git_repo" execID=QkYjC
time="2021-05-27T15:50:35Z" level=info msg=Trace args="[git clean -fdx]" dir="/tmp/my_internal_git_repo" operation_name="exec git" time_ms=2.3974349999999998

@jgwest
Copy link
Member

jgwest commented May 30, 2021

@rumstead, looks like we're stuck with those messages for now, without an upstream Argo CD patch to reduce their verbosity.

@rumstead
Copy link
Contributor

rumstead commented Jun 1, 2021

Ok, the PR adds the scaffolding to support multiple log levels.

jgwest pushed a commit that referenced this issue Jun 2, 2021
* feat(loglevel): adding loglevel flag to set loglevel

* chore: don't shadow package name.

* chore(goimports): file watcher didn't run

* chore: check, report, and exit if we cannot set the log level
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants