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

A flag for setting the log level and more verbose log output #220

Closed
maelvls opened this issue Mar 9, 2021 · 3 comments · Fixed by #627
Closed

A flag for setting the log level and more verbose log output #220

maelvls opened this issue Mar 9, 2021 · 3 comments · Fixed by #627
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@maelvls
Copy link
Member

maelvls commented Mar 9, 2021

I am stuck with a non-working preflight agent on my cluster. Before going further (i.e., using mitmproxy to see what is going on with the HTTP request being made to plaform.jetstack.io), I wondered: is there a "debug" mode that would make the logs a bit more verbose?

By verbose, I would probably expect to see some of the request being made: see the 200 OK and so on. And maybe also some of the payload and the HTTP headers on the request and response.

The agent does not seem to have any --level or -v flag though:

% preflight agent -h
The agent will periodically gather data for the configured data
	gatherers and send it to a remote backend for evaluation

Usage:
  preflight agent [flags]
  preflight agent [command]

Available Commands:
  info        print several internal parameters of the agent

Flags:
  -c, --agent-config-file agent.yaml   Config file location, default is agent.yaml in the current working directory. (default "./agent.yaml")
      --backoff-max-time duration      Max time for retrying failed data gatherers (given as XhYmZs). (default 10m0s)
  -k, --credentials-file string        Location of the credentials file. For OAuth2 based authentication.
  -h, --help                           help for agent
      --input-path string              Input file path, if used, it will read data from a local file instead of gathering data from clusters
      --one-shot                       Runs agent a single time if true, or continously if false
      --output-path string             Output file path, if used, it will write data to a local file instead of uploading to the preflight server
  -p, --period duration                Override time between scans in the configuration file (given as XhYmZs).
      --strict                         Runs agent in strict mode. No retry attempts will be made for a missing data gatherer's data.

Use "preflight agent [command] --help" for more information about a command.
@maelvls maelvls changed the title A flag for setting the log level? A flag for setting the log level and more verbose log output Mar 9, 2021
@maelvls
Copy link
Member Author

maelvls commented Mar 9, 2021

/kind feature
/priority backlog

@jetstack-bot jetstack-bot added kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Mar 9, 2021
@maelvls
Copy link
Member Author

maelvls commented Aug 23, 2024

Still a problem in 0.1.49.

We have already done something similar (logging HTTP requests and responses) in https://github.com/jetstack/venafi-connection-lib/pull/143, although I didn't log the responses for some reason... We should do something similar here.

What makes me want to do this is because I've been in two "debugging sessions" with customers, and having a way to log HTTP traffic would be immensely helpful.

@wallrj
Copy link
Member

wallrj commented Nov 20, 2024

We introduced a -v / --log-level flag in #596.

Which allows you to see the details of Kubernetes API requests but I don't think we've set up the logging to allow trace level log messages from venafi-connection-lib ...I'll look into that.

I1120 16:30:38.027359       1 reflector.go:341] Listing and watching firefly.venafi.com/v1, Resource=issuers from k8s.io/client-go@v0.31.1/tools/cache/reflector.go:243
I1120 16:30:38.027838       1 round_trippers.go:466] curl -v -XGET  -H "Accept: application/json" -H "User-Agent: preflight/v0.0.0 (linux/amd64) kubernetes/$Format" -H "Authorization: Bearer <masked>" 'https://34.118.224.1:443/apis/firefly.venafi.com/v1/issuers?limit=500&resourceVersion=0'
I1120 16:30:38.031924       1 round_trippers.go:553] GET https://34.118.224.1:443/apis/firefly.venafi.com/v1/issuers?limit=500&resourceVersion=0 404 Not Found in 4 milliseconds
I1120 16:30:38.032041       1 round_trippers.go:570] HTTP Statistics: GetConnection 0 ms ServerProcessing 3 ms Duration 4 ms
I1120 16:30:38.032137       1 round_trippers.go:577] Response Headers:
I1120 16:30:38.032236       1 round_trippers.go:580]     Date: Wed, 20 Nov 2024 16:30:38 GMT
I1120 16:30:38.032317       1 round_trippers.go:580]     Audit-Id: f34bf0ec-a85a-4e5d-afda-9c17381ec81d
I1120 16:30:38.032399       1 round_trippers.go:580]     Cache-Control: no-cache, private
I1120 16:30:38.032482       1 round_trippers.go:580]     Content-Type: text/plain; charset=utf-8
I1120 16:30:38.032565       1 round_trippers.go:580]     X-Content-Type-Options: nosniff
I1120 16:30:38.032645       1 round_trippers.go:580]     X-Kubernetes-Pf-Flowschema-Uid: 9a62d166-f78a-4e8e-aaa3-8d2067b77699
I1120 16:30:38.032728       1 round_trippers.go:580]     X-Kubernetes-Pf-Prioritylevel-Uid: e89d9c7d-1c13-4179-b303-d928bb76a2fe
I1120 16:30:38.032804       1 round_trippers.go:580]     Content-Length: 19
I1120 16:30:38.032947       1 request.go:1351] Response Body: 404 page not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants