-
Notifications
You must be signed in to change notification settings - Fork 28
Logrus logs #423
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
Logrus logs #423
Conversation
Co-authored-by: Restyled.io <[email protected]>
Sample — b56e1cd snapshotresource "iterative_task" "sample" {
cloud = "az"
script = <<-END
#!/bin/bash
echo "Hello World"
END
} $ TF_LOG_PROVIDER=INFO terraform refresh
2022-03-03T17:22:19.387Z [INFO] provider: configuring client automatic mTLS
2022-03-03T17:22:19.423Z [INFO] provider.terraform-provider-iterative: configuring server automatic mTLS: timestamp=2022-03-03T17:22:19.423Z
2022-03-03T17:22:19.450Z [INFO] provider: configuring client automatic mTLS
2022-03-03T17:22:19.485Z [INFO] provider.terraform-provider-iterative: configuring server automatic mTLS: timestamp=2022-03-03T17:22:19.485Z
2022-03-03T17:22:19.512Z [INFO] provider: configuring client automatic mTLS
2022-03-03T17:22:19.549Z [INFO] provider.terraform-provider-iterative: configuring server automatic mTLS: timestamp=2022-03-03T17:22:19.549Z
iterative_task.task: Refreshing state... [id=tpi-1mb61lbbee8oj-27liktpn-6bfaepcv]
2022-03-03T17:22:19.581Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:19 [INFO] Reading ResourceGroup...: timestamp=2022-03-03T17:22:19.581Z
2022-03-03T17:22:20.244Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:20 [INFO] Reading StorageAccount...: timestamp=2022-03-03T17:22:20.244Z
2022-03-03T17:22:20.599Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:20 [INFO] Reading BlobContainer...: timestamp=2022-03-03T17:22:20.599Z
2022-03-03T17:22:20.807Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:20 [INFO] Reading Credentials...: timestamp=2022-03-03T17:22:20.807Z
2022-03-03T17:22:20.807Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:20 [INFO] Reading VirtualNetwork...: timestamp=2022-03-03T17:22:20.807Z
2022-03-03T17:22:21.418Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:21 [INFO] Reading SecurityGroup...: timestamp=2022-03-03T17:22:21.418Z
2022-03-03T17:22:21.588Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:21 [INFO] Reading Subnet...: timestamp=2022-03-03T17:22:21.588Z
2022-03-03T17:22:21.769Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:21 [INFO] Reading VirtualMachineScaleSet...: timestamp=2022-03-03T17:22:21.769Z
2022-03-03T17:22:22.719Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:22 [INFO] Done!: timestamp=2022-03-03T17:22:22.719Z
2022-03-03T17:22:25.799Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:25 [INFO] Reading ResourceGroup...: timestamp=2022-03-03T17:22:25.799Z
2022-03-03T17:22:25.835Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:25 [INFO] Reading StorageAccount...: timestamp=2022-03-03T17:22:25.835Z
2022-03-03T17:22:26.231Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:26 [INFO] Reading BlobContainer...: timestamp=2022-03-03T17:22:26.231Z
2022-03-03T17:22:26.413Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:26 [INFO] Reading Credentials...: timestamp=2022-03-03T17:22:26.413Z
2022-03-03T17:22:26.413Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:26 [INFO] Reading VirtualNetwork...: timestamp=2022-03-03T17:22:26.413Z
2022-03-03T17:22:27.039Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:27 [INFO] Reading SecurityGroup...: timestamp=2022-03-03T17:22:27.039Z
2022-03-03T17:22:27.229Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:27 [INFO] Reading Subnet...: timestamp=2022-03-03T17:22:27.229Z
2022-03-03T17:22:27.403Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:27 [INFO] Reading VirtualMachineScaleSet...: timestamp=2022-03-03T17:22:27.403Z
2022-03-03T17:22:27.939Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:27 [INFO] Done!: timestamp=2022-03-03T17:22:27.939Z
2022-03-03T17:22:28.982Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:28 [INFO] Reading ResourceGroup...: timestamp=2022-03-03T17:22:28.981Z
2022-03-03T17:22:28.994Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:28 [INFO] Reading StorageAccount...: timestamp=2022-03-03T17:22:28.994Z
2022-03-03T17:22:29.376Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:29 [INFO] Reading BlobContainer...: timestamp=2022-03-03T17:22:29.376Z
2022-03-03T17:22:29.570Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:29 [INFO] Reading Credentials...: timestamp=2022-03-03T17:22:29.570Z
2022-03-03T17:22:29.570Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:29 [INFO] Reading VirtualNetwork...: timestamp=2022-03-03T17:22:29.570Z
2022-03-03T17:22:29.743Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:29 [INFO] Reading SecurityGroup...: timestamp=2022-03-03T17:22:29.743Z
2022-03-03T17:22:29.915Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:29 [INFO] Reading Subnet...: timestamp=2022-03-03T17:22:29.915Z
2022-03-03T17:22:30.086Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:30 [INFO] Reading VirtualMachineScaleSet...: timestamp=2022-03-03T17:22:30.086Z
2022-03-03T17:22:30.583Z [INFO] provider.terraform-provider-iterative: 2022/03/03 17:22:30 [INFO] Done!: timestamp=2022-03-03T17:22:30.583Z
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] tpi-1mb61lbbee8oj-27liktpn-6bfaepcv [0011] 🚀 az m at us-west
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] tpi-1mb61lbbee8oj-27liktpn-6bfaepcv [0011] Task logs:-- Logs begin at Thu 2022-03-03 17:18:51 UTC, end at Thu 2022-03-03 17:22:22 UTC. --
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] Mar 03 17:19:48 tpi000000 systemd[1]: Started tpi-task.service.
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] Mar 03 17:19:48 tpi000000 tpi-task[1803]: Hello World
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] Mar 03 17:19:48 tpi000000 bash[1804]: NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] Mar 03 17:20:08 tpi000000 tpi-task-shutdown[1915]: 2022/03/03 17:20:08 [INFO] Stopping task tpi-1mb61lbbee8oj-27liktpn-6bfaepcv...
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO]
2022-03-03T17:22:31.220Z [INFO] provider.terraform-provider-iterative: [INFO] tpi-1mb61lbbee8oj-27liktpn-6bfaepcv [0011] Task is terminated succesfully 🟢 |
@0x2b3bfa0 Update to your comment. Your original logs now use Logrus |
I wonder why your logs are repeated three times. Is the refresh operation running it several times? |
Co-authored-by: Restyled.io <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Yes, it's running several times and can be optimized to run only once. See #290 for context. |
Side topic: we already were duplicating the functionality of official providers, reinventing the Terraform planner, but after this pull request we're also bypassing Terraform Core to print our own logs. I'd prefer not to divert this thread towards the discussion of the advantages and disadvantages of these choices, but it feels like it's something we should be aware of. |
The ability of custom logs is something that Terraform know and indeed they are willing to fix
Having parallel logs are normal. However for the refresh "report" they should be all them together. I have found after several trial that the logs were always fine. I mean the report stayed together without having applied any parallelism constrain. |
icons are better than text and easy to be followed within a bunch of text. Its not about emojis it's about icons |
Sounds like an x–y problem: polished command–line tools usually don't bury useful information behind “a bunch of text” unless users explicitly ask for the latter.
💯 See |
I don't see any signs of enthusiasm there. Especially after hashicorp/terraform#17267 (comment). 🤔 |
Yes, if you print all the logs at once and the process takes a split second, it would be moderately hard to hit this condition. Still, rest assured that it will happen. 🙃 Anyway. |
"...Instead, any output from providers will need to be designed with a suitable structure that it can be translated to both a terminal-based UI and to other UI contexts such as Terraform Cloud's web UI,..." What distil is that they are not willing to support any output but be able to specify a closed JSON format to be displayed on the UI and or the Cloud's UI. It's pretty clear. They are not telling they are not supporting it. |
bikeshedding? |
Definitely bikeshedding, but if we had full control of the terminal and outputted less text, I would prefer alternatives like |
And that format will be oriented towards sane, officially supported use cases, not printing thousands of log lines to the console. |
I don't think they're closing that issue any time soon.
So they can be disabled? How?
and
💯 I see the value in visual cues, however the different colours are enough for this (no need to have emoji). |
unfortunately they can't |
Either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i hate everything about this 😅
The purpose is to offer an insight digest report on refresh of Task status and script logs.
[LOG_LEVEL]
from the given log. Our formatter parses the desired logrus level from the call and sets the logs initial level. I.E.d schemaData
and uses it to signal the logs.Usage
export TF_LOG_PROVIDER=INFO
orexport TF_LOG_PROVIDER=DEBUG
prior to use terraformCloses