ekristen / aws-nuke

Remove all the resources from an AWS account
https://ekristen.github.io/aws-nuke/
MIT License
256 stars 26 forks source link

[idea] structured logs/report #154

Open so0k opened 7 months ago

so0k commented 7 months ago

Rather than rely on string parsing such as this tool oijkn/aws-nuke-exporter, aws-nuke could have an option to output structured logs (--output or --json flag).

so0k commented 7 months ago

assuming it wouldn't be too hard to add it into here: https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/global/global.go

let me know if you'd like me to give it a shot and open a PR for this

ekristen commented 7 months ago

@so0k this was on my backlog of things I wanted to do. The changes would have to start in libnuke, but wouldn't be super hard. JSON is a given format, but what are you wanting the output to have? Do you have an example?

I'm always down for contributors, but this will require to PRs on two repos to make happen, please check out the contributing docs. I'm following semantic commits, require all commits to be signed. The goal here is to setup some good guidance to allow others to contribute and get things merged quick and reliably instead of them getting stale.

With that in mind, I like this idea, I can probably get it done by the weekend.

vincenthsh commented 7 months ago

Sounds good @ekristen - I definitely won't have time soon to work on this

ekristen commented 5 months ago

This is a little more difficult to implement. Requires several changes, but I like it and I've been working on it.

kieran-lowe commented 2 months ago

This would be awesome to have as well. Was seeing if an option was available then saw this! +1 from me

ekristen commented 1 month ago

This is a work in progress .. https://github.com/ekristen/aws-nuke/pull/368

ekristen commented 1 month ago

@so0k @kieran-lowe @vincenthsh any feedback on how to handle the output when doing prompts like to confirm the run? Put everything into structured logging except for prompts? I suppose I could prevent structured logging when in "interactive" mode, like TTY/terminal with a prompts active.

kieran-lowe commented 1 month ago

@so0k @kieran-lowe @vincenthsh any feedback on how to handle the output when doing prompts like to confirm the run? Put everything into structured logging except for prompts? I suppose I could prevent structured logging when in "interactive" mode, like TTY/terminal with a prompts active.

I would propose that the prompts should be left as they are when "interactive" and only the output of the run is what is logged in JSON as I'd argue that is what most want the JSON output for.

Maybe you could have an option where it logs the prompts used on that specific run maybe? So you have this JSON output that shows the results of the run, and the prompts/flags chosen by the user that generated the run.

cland commented 1 month ago

@so0k @kieran-lowe @vincenthsh any feedback on how to handle the output when doing prompts like to confirm the run? Put everything into structured logging except for prompts? I suppose I could prevent structured logging when in "interactive" mode, like TTY/terminal with a prompts active.

I would propose that the prompts should be left as they are when "interactive" and only the output of the run is what is logged in JSON as I'd argue that is what most want the JSON output for.

Maybe you could have an option where it logs the prompts used on that specific run maybe? So you have this JSON output that shows the results of the run, and the prompts/flags chosen by the user that generated the run.

I agree with @kieran-lowe here @ekristen. Typically non-interactive processes that probably runs on schedule would require this to be able to easily report on the outcomes.