Integration with Terraform
This guide explains how to forward Terraform logs to OpenObserve using Fluent Bit.
Overview
Terraform doesn’t log to files by default. This integration enables detailed logging by setting environment variables and then uses Fluent Bit to ship those logs to OpenObserve. The setup is lightweight, easy to run locally, and enables structured log analysis and dashboarding for infrastructure-as-code workflows.
Steps to Integrate
Prerequisites
- Terraform installed
- OpenObserve account (Cloud or Self-Hosted)
Step 1: Enable Logging in Terraform
-
Set environment variables:: Add the following lines to your shell profile (
>~/.zshrc,~/.bashrc, etc.):TF_LOG=DEBUGcaptures detailed debug-level logs.
>TF_LOG_PATHsets the location where logs are written. -
Test log generation:: Run any Terraform command, such as:
tf.log is created in your working directory and is populated with Terraform debug logs.
Step 2: Configure Fluent Bit
-
Install Fluent Bit:
On Linux or Windows, install Fluent Bit using platform-specific methods: Fluent Bit installation guide
-
Create a Fluent Bit config file (e.g.,
fluent-bit.conf):
[INPUT]
Name tail
Path ./tf.log
Tag terraform
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Read_from_Head On
[FILTER]
Name record_modifier
Match terraform
Record level DEBUG
[FILTER]
Name record_modifier
Match terraform
Record log_source terraform
[OUTPUT]
Name http
Match *
URI /api/default/terraform/_json
Host localhost
Port 5080
tls Off
Format json
Json_date_key _timestamp
Json_date_format iso8601
HTTP_User <openobserve_user>
HTTP_Passwd <openobserve_basic_password>
compress gzip
Key Settings:
Path: Location of the Terraform log fileTag: Identifies the Terraform logsrecord_modifier: Adds metadata likelevelandlog_sourceHTTP_UserandHTTP_Passwd: Your OpenObserve credentials
Step 3: Run Fluent Bit
- Start Fluent Bit with your config file:
This will start reading
tf.logand forwarding entries to OpenObserve in real time.
Step 4: Validate Logs in OpenObserve
- In your Openobserve instance, Go to Logs → select your log stream → Set time range → Click Run Query

Troubleshooting
tf.log not generated?
- Ensure both
TF_LOGandTF_LOG_PATHare exported in your shell - Run
terraform planorterraform applyto trigger log generation - Verify
tf.logexists in the specified path
Fluent Bit not forwarding logs?
- Confirm that the
Pathin[INPUT]matches your actualtf.loglocation - Run Fluent Bit with
-vvto see verbose logs - Ensure OpenObserve is reachable at
localhost:5080
No logs in OpenObserve?
- Check for correct username/password in the
[OUTPUT]section - Confirm the URI path matches your OpenObserve stream:
- Look for errors in the Fluent Bit output
Log fields missing or incorrect?
- Check the
[FILTER]configuration log_sourceandlevelfields should be injected byrecord_modifier- Verify your log entries contain structured key-value output