falcosecurity/falcoctl

Adding a global option to log all HTTP requests

loresuso opened this issue · 4 comments

What would you like to be added:
As per issue title, implement a global --log-http option.

Why is this needed:
Since falcoctl is at the end of the day an HTTP client, it might come in handy for debugging purposes and solving users' issues to implement this option, and also when using this tool with environments we didn't personally tested. My personal take on how to do it: we could try to modify our client and to let it accept another functional option called for instance WithHTTPLogger. If something != nil is passed, we could replace the HTTP transport with a custom one, wrapping the logging capability in the RoundTrip function.
I did something similar here to implement a backoff logic: https://github.com/falcosecurity/falcoctl/blob/main/cmd/artifact/follow/follow.go#L425