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: B

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged to standard error (stderr), not to syslog. By default, Terraform logs output to stderr, which is useful for capturing logs in the terminal or console where Terraform commands are being run. If logs need to be redirected to a file or another destination such as syslog, this would require additional configuration or tools beyond simply setting the TF_LOG environment variable.

Discussion

36 comments
Sign in to comment
Oskar_Madin
Dec 28, 2022

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

esandips
Oct 29, 2022

B TF_LOG_PATH needs to be set as well

scepticemia
Nov 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
Nov 18, 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
Jan 10, 2023

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.

AzRNoob
Oct 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.

MisterR0B0T
Apr 30, 2024

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
Jul 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.

abconline
Nov 29, 2022

it should be false as it wont write to syslog but will just display on screen

kilowd
Feb 28, 2023

Agree with @abcoline: If TF_LOG_PATH is not set, output is sent to standard output and error in the terminal. If the environment variable is set, Terraform will append logs from each run to the specified file.

starkonbulletOption: B
Nov 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).

pj2001
Nov 27, 2022

B, TF_LOG setting would send logs to stderr / console / terminal, not syslog

campsOption: B
Sep 30, 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.

bp339Option: B
Dec 5, 2022

Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear on stderr. https://www.terraform.io/internals/debugging

RVivekOption: B
Mar 23, 2023

TF_LOG will enable log and send that to stderr (by default it iscreen) not to any syslog server. TF_LOG_PARH can be set to redirect logs to a specific file

styroOption: B
Sep 11, 2023

ChatGPT says B, good enough for me!

HalimbOption: B
Mar 4, 2024

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.

DianaPopal
Jun 28, 2024

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.

Zam88
Dec 23, 2022

How do you get Terraform logs? Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear on stderr. You can set TF_LOG to one of the log levels TRACE , DEBUG , INFO , WARN or ERROR to change the verbosity of the logs. B

EltoothOption: A
Dec 27, 2022

A is correct answer. True. "Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear on stderr." "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." https://www.terraform.io/internals/debugging "Logging is off for all subsystems by default. To enable logging for a Terraform run, set one or more logging environment variables to either JSON format or a verbosity level." "Use TF_LOG_PATH to specify a file path where the log output file should be written. If you do not specify a log path, Terraform writes the specified log output to stderr." Terraform can automatically create the output file at TF_LOG_PATH if it does not already exist. If the file does exist, Terraform adds new log output onto the end of the file without truncating the file contents." https://www.terraform.io/plugin/log/managing#enable-logging

Eltooth
Jan 6, 2023

stderr outputs to screen. Answer should be B. https://www.computerhope.com/jargon/s/stderr.htm#:~:text=Stderr%2C%20also%20known%20as%20standard,defaults%20to%20the%20user's%20screen.

Zam88
Dec 28, 2022

B false

SilentMilliOption: B
Sep 12, 2023

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into standard error (stderr), not syslog. By default, Terraform logs only errors and above (e.g., warnings, errors, and critical messages) to stderr. However, you can increase the verbosity of the logs by setting the TF_LOG environment variable to a specific log level, such as TRACE, DEBUG, INFO, or WARN. When the log level is set to DEBUG, Terraform will log additional debugging information to stderr, which can be useful for troubleshooting and diagnosing issues.

NunyabiznesOption: B
Sep 21, 2023

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged to standard error (stderr), not syslog. By default, Terraform logs only warnings and errors to stderr, but by setting the TF_LOG environment variable, you can also log info and debug messages. The available log levels are TRACE, DEBUG, INFO, WARN, and ERROR.

nirosha1Option: A
Oct 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

Spandrop
Feb 29, 2024

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
Mar 29, 2024

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."

vibzr2023
Sep 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

EltoothOption: B
Jan 6, 2023

B is correct answer. Use TF_LOG_PATH to specify a file path where the log output file should be written. If you do not specify a log path, Terraform writes the specified log output to stderr. "Stderr, also known as standard error, is the default file descriptor where a process can write error messages. In Unix-like operating systems, such as Linux, macOS X, and BSD, stderr is defined by the POSIX standard. Its default file descriptor number is 2. In the terminal, standard error defaults to the user's screen." https://www.computerhope.com/jargon/s/stderr.htm#:~:text=Stderr%2C%20also%20known%20as%20standard,defaults%20to%20the%20user's%20screen.

Ahmad_Terraform
Jan 13, 2023

B is correct

lightbrd
Mar 15, 2023

Its B. If TF_LOG_PATH is empty (which is by default) the debug logs are directed to STDOUT ( terminal)

Pinky0289
Mar 17, 2023

The answer should be B. False. Setting TF_LOG variable to any env var ( TRACE, DEBUG, INFO, WARN, and Error) just causes it to display logs to stderr. In order to persist the log, TF_LOG_PATH needs to be set.

col2511kolOption: A
Aug 9, 2023

Terraform provides the options to enable detailed logging/debugging with the help of the TF_LOG environment variable. It provides the option to set TF_LOG to various different log levels: TRACE, DEBUG, INFO, WARN or ERROR. TRACE: Very detailed verbosity, shows every step taken by Terraform, and produces enormous outputs with internal logs. DEBUG: describes what happens internally in a more concise way compared to TRACE. ERROR: shows errors that prevent Terraform from continuing. WARN: logs warnings, which may indicate misconfiguration or mistakes, but are not critical to the execution. INFO: shows general, high-level messages about the execution process. To persist the generated logs you need to set the TF_LOG_PATH environment variable in order to force the log to always be appended to a specific file when logging is enabled.

itbrpl
Aug 14, 2023

C'mon guys!! TF_LOG controls only the log level that will be displayed on the screen.. TF_LOG_PATH will not send logs to a syslog it will send to a file... isn't it? when I think about syslog I am thinking about a syslog server... but anyway....

jojom19980
Sep 5, 2023

debug messages to be logged into syslog. !!!! no sure the answer is B false

David_C_90Option: B
Sep 15, 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

AWS_cert2023
Dec 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
Feb 26, 2024

B is the right answer and stop confusing people

SauravAmuze
Jul 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)

kingfighers
Oct 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

anirudhgundaOption: B
Mar 14, 2025

The correct answer is: B. False Explanation: Setting the TF_LOG environment variable to DEBUG enables detailed debugging messages in Terraform, but these messages are printed to standard error (stderr), not to syslog. Terraform does not automatically log messages to syslog. If you want to capture Terraform logs in syslog, you would need to manually redirect the output, for example: sh Copy Edit TF_LOG=DEBUG terraform apply 2>&1 | tee /var/log/terraform.log Alternatively, you can configure external logging mechanisms to capture Terraform's debug output if needed.