-
-
Notifications
You must be signed in to change notification settings - Fork 999
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
Option for less verbose output #432
Comments
Not currently, but there should be. I'd welcome a PR to move Terragrunt to a proper logging system with INFO/DEBUG/etc and a way to set the log level via CLI. We've been meaning to move it over to gruntwork-cli as the base, which has that sort of logging built-in, but haven't had time. A PR for that is very welcome. In the meantime, a workaround is to note that Terragrunt logs everything to |
solution for bash only: terragrunt apply 2> >(grep -v "\[terragrunt]" >&2) STDOUT and STDERR lines are preserved except [terragrunt] ones |
One side-effect of this is that As well, if you're overriding the |
Terragrunt logs everything to stderr, so |
Sorry, I meant that the regex above will not catch all lines from terragrunt - specifically, if you have an un-initialized module, some lines will be missing the prefix. Apologies! I'd assume that the terraform call also outputs to stderr in some instances, so redirecting all stderr wouldn't be a great solution in those cases. |
Ah, I gotcha, thanks for clarifying.
Yea, Terraform also logs to stderr. However, command where you are explicitly asking something to be printed such as |
use the scenery for this, it will filter out the terragrunt output and you will also win colors =D
|
Unfortunately, It has problems both with |
To add to the bash solution provided by @ezh, I ran into issues with testing syntax during tf .11 --> .12 upgrades (e.g.
I came up with a slightly more explicit regex that helps prune away some of the excess terragrunt stderr output that we don't generally need to see when running every pipeline, however still shows the output to errors such as the one above. Solution: Basically, this grep inversely redirects any lines that start with
We'll still see errors, and other output, such as
2nd example:
I do strongly feel that debugging levels would be very beneficial with terragrunt, and would love to see them implemented eventually, so long as this tool continues to be useful. I do understand that it's getting less necessary alongside terraform with the recent additions found in .12, however there still seems to be enough use unique cases out there that it feels worth the while to implement a way to manage levels of output verbosity - especially considering this stderr redirect (work-around) requires calling bash, when we often use alpine based containers that don't have bash natively added. |
redirect stderr to /dev/null and you will have only the terraform outputs in a clean format i.e terragrunt apply-all 2> /dev/null |
@yanivillouz but what if you're troubleshooting an error? also, with the recursive nature of |
the original question was to get terraform outputs only, this seems to
solves the request.
you are right of course that this is not the approach for debugging issues
…On Mon, Feb 24, 2020 at 5:13 PM Scott Baxter ***@***.***> wrote:
redirect stderr to /dev/null
but what if you're troubleshooting an error? also, with the recursive
nature of terragrunt *-all, the output is not consistently in order, and
often difficult to determine what output belongs to which path/folder. i
think some work on better output for testing/troubleshooting (especially
developing new patterns) would be hugely useful, here.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#432?email_source=notifications&email_token=ABSAGEE5JEB3HMJEJEXNZFTREPPZJA5CNFSM4EUDU2PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMYFSMA#issuecomment-590371120>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSAGEBUMXIFMQDBGJNJVIDREPPZJANCNFSM4EUDU2PA>
.
|
@yanivillouz Your "solution" is not different from the first very response in this issue. Redirecting all stderr for terraform will definitely omit a lot of important output from terraform itself. Please help avoid excess noise by reading through the entire conversation, if you feel like contributing to issues. |
On our CI servers, we wanted to display just the plan output when terragrunt ran successfully, but wanted to display all logs if anything went wrong. Here's a gist for a quick node wrapper that achieves our goal for |
What I'd mostly like to see is deduplicating path components in the output. What I mean is, lines like this:
Could be made significantly less verbose, something like:
|
This moves majority of Terragrunt's output to DEBUG level, and sets default output mode to ERROR. The idea is that in default run user should see much less output. Closes: gruntwork-io#432
Apart from small fixes, this: - adds deprecation check for command line arguments, and gives a warning if `--terragrunt-debug` is used; - imports `logrus` under its own name to avoid confusion; Related: gruntwork-io#432
This moves majority of Terragrunt's output to DEBUG level, and sets default output mode to ERROR. The idea is that in default run user should see much less output. Closes: gruntwork-io#432
Apart from small fixes, this: - adds deprecation check for command line arguments, and gives a warning if `--terragrunt-debug` is used; - imports `logrus` under its own name to avoid confusion; Related: gruntwork-io#432
* Option for less verbose output This moves majority of Terragrunt's output to DEBUG level, and sets default output mode to ERROR. The idea is that in default run user should see much less output. Closes: #432 * Updated after review Apart from small fixes, this: - adds deprecation check for command line arguments, and gives a warning if `--terragrunt-debug` is used; - imports `logrus` under its own name to avoid confusion; Related: #432 * Updates after review | 2 Main change - global LogEntry object introduced in `util/logger.go`. It helps us log properly when we didn't yet parse command line arguments * Fix tests for `cli/cli_app.go` P.S. Tests rock! * Rework global logger Global logger should be a fallback option, rather a way to go. So instead of using the same everywhere, we use global if no other logger is available (for example, if we have not yet parsed arguments). This change also addresses other PR review comments, like: - wrong documentation; - using `logrus.WarnLevel.String()` instead of hardcoded strings; - updated `isDeprecatedOption()`, with a more clear usage; * Fix typo in docs section * Apply `go fmt` properly * Apply `go fmt` properly | 2 * Fix `TestParseTerragruntOptionsFromArgs` test * Terragrunt should output all log to stderr * Set stderr as default output * Update TestApplySkipTrue() Add `--terragrunt-log-level info`, so that we could test it. * Fix tests This fixes tests that rely on double output of `run_shell`, as well as brings back `--terragrunt-debug`, but in slightly different form: to only generate `terragrunt-debug.tfvars.json` * Remove `--terragrunt-debug` from excluded and fix `\n` Terragrunt integration tests depend on newlines, and to ensure that logrus can properly print newlines with `\n` `DisableQuote: true` is needed [1]. In particular, this fixes `TestIncludeDirsDependencyConsistencyRegression` and `TestIncludeDirsStrict`. [1] - sirupsen/logrus#608 * Bring `--terragrunt-debug` tests back
Is there an option that will hide a lot of the extra information that terragrunt outputs? While this information is nice to see, it would be nice to have a clean output that would just show us the raw output from terraform.
The text was updated successfully, but these errors were encountered: