Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 50


Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.

Show Answer
Correct Answer: AB

A

Reference:

https://www.terraform.io/docs/internals/debugging.html

Discussion

17 comments
Sign in to comment
Oskar_Madin
Jun 28, 2022

please stop writing or suggestions if you don't know the answer or are not sure!

esandipsOption: B
Apr 29, 2022

B TF_LOG_PATH needs to be set as well

scepticemia
May 12, 2022

Incorrect. A is the correct answer. TF_LOG_PATH just enables persistent logging to be appended to a specific file. From the docs: To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled. https://www.terraform.io/internals/debugging

bigboi23
May 17, 2022

No. A is correct. To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled. Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.

nhatne
Jul 10, 2022

B is correct because TF_LOG_PATH IS NOT REQUIRED, in the docs, they do not mention HAVE TO SET TF_LOG_PATH, it is optional, therefore without TF_LOG_PATH will cause detailed logs to appear on stderr.

AzRNoobOption: B
Apr 7, 2023

FALSE Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged to standard error (stderr) output, not to syslog.

MisterR0B0TOption: B
Oct 31, 2023

The answer is False. Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged to the standard error stream (stderr). It does not log messages to syslog. Syslog is a standard logging system that is used by many Unix-like operating systems to collect and store system log messages. Syslog messages are typically stored in a file called /var/log/syslog. Terraform does not log messages to syslog by default. To log Terraform messages to syslog, you can use a third-party logging tool, such as Logstash or Fluentd. These tools can be configured to collect logs from stderr and send them to syslog. Here is an example of how to use Logstash to send Terraform logs to syslog: input { stdin { type => "plain" filter => { remove_field => ["message.level"] add_field => { "message.level" => "debug" } } } } output { syslog { host => "localhost" } }

Siva_7282Option: B
Jan 30, 2024

B. False Setting the TF_LOG environment variable to DEBUG does not automatically log debug messages into syslog. Instead, it causes Terraform to print debug messages to the standard error (stderr) output. If you want to capture or redirect these debug messages, you need to handle the stderr output accordingly, such as redirecting it to a file or using other logging mechanisms.

campsOption: B
Mar 31, 2023

B. False. Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged to the console, not to syslog. The TF_LOG environment variable is used to control the level of logging in Terraform. When set to DEBUG, Terraform will log detailed debug messages to the console, which can be useful for troubleshooting issues.

HalimbOption: B
Sep 4, 2023

https://developer.hashicorp.com/terraform/cli/config/environment-variables Quote "Enables detailed logs to appear on stderr which is useful for debugging." By default, regardless of the log level, Terraform writes its log output to the standard error (stderr) stream. This behavior is useful for capturing log messages in the terminal or console where you are running Terraform commands, allowing you to see any warnings or errors in real-time. If you wish to redirect the log output to a file or another destination, you can use standard shell redirection as shown in my previous response. This allows you to save the log information for later analysis or to separate it from the terminal output.

DianaPopalOption: B
Dec 28, 2023

B. False Setting the TF_LOG environment variable to DEBUG in Terraform does not cause debug messages to be logged into syslog. The TF_LOG environment variable is used to control the logging level of Terraform itself, not the system's syslog service. When TF_LOG is set to DEBUG, Terraform will output detailed debug messages to the standard error output (stderr) or the log file specified in the Terraform configuration.

nirosha1Option: A
Apr 27, 2023

Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on stderr. https://developer.hashicorp.com/terraform/internals/debugging

SpandropOption: B
Aug 31, 2023

Correct answer is B "Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on stderr." There is nothing to do with syslog https://developer.hashicorp.com/terraform/internals/debugging

gofavad926Option: A
Sep 29, 2023

A, it appears in stderr. As documentation says: "Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on stderr."

vibzr2023Option: B
Mar 27, 2024

B is correct Setting the TF_LOG environment variable to DEBUG does indeed enable detailed debug messages from Terraform, but these messages are not automatically logged to syslog. By default, when TF_LOG is set, Terraform logs messages to stderr. To direct these logs to a file or another logging destination like syslog, you would need to manually redirect the output or use additional tools or settings specific to your operating system or environment. For example, in a Unix-like environment, you could redirect the Terraform command's stderr to a file or to syslog using command-line redirection or tools like logger. But this is not something Terraform does automatically just by setting TF_LOG to DEBUG. To log Terraform's output to a file, you might run a command like: TF_LOG=DEBUG terraform apply 2>terraform-debug.log

starkonbulletOption: B
May 17, 2024

B. False. Setting the TF_LOG environment variable to "DEBUG" does not cause debug messages to be logged into syslog. It actually causes the Terraform command-line tool to emit detailed debug output to the console (standard error output, specifically).

AWS_cert2023Option: B
Jun 9, 2023

Enabling this setting causes detailed logs to appear on stderr. Uses TF_LOG_PATH to change the path of log info.

debabrata6983Option: B
Aug 26, 2023

B is the right answer and stop confusing people

SauravAmuzeOption: B
Jan 29, 2024

Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on 'stderr' .There is no mention of 'syslog' in the manual. So the answer is B (False)

kingfighersOption: B
Apr 2, 2024

B Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on stderr. https://developer.hashicorp.com/terraform/internals/debugging