Logs
Terraform Enterprise logs directly to standard output and standard error. This allows you to forward logs using native tooling for your deployment platform.
Log location and format
The individual service logs are located within the
/var/log/terraform-enterprise
directory inside the container.
Each service log is a plain text file containing the logs for that service. Logs are collated and logged to the container's standard output in JSON format. Each log entry contains two fields:
component
: The name of the individual service that emitted the log entry.log
: The contents of the log message.
An example set of log entries emitted by a Terraform Enterprise container would appear as follows:
Note that the format of individual service logs is considered an internal implementation detail and is subject to change at any release.
External log forwarding
We strongly recommend using an external log forwarding solution that aligns with your existing observability solutions. Depending on the deployment platform, native or third-party solutions (e.g., host-level monitoring agents) may be an appropriate solution for log aggregation and forwarding. Hashicorp does not provide support for third-party log forwarding solutions.
Docker
Docker supports a multitude of logging drivers. See the Docker logging driver list for what options are available.
Kubernetes
Kubernetes supports several architectures for log-forwarding. See the Kubernetes logging architectures documentation for what options are available.
Native log forwarding
As a convenience to aid in migrating from legacy Replicated environments
to Flexible Deployments, Terraform Enterprise provides a mechanism to inject
FluentBit [OUTPUT]
configuration directives. This allows Terraform Enterprise
to use FluentBit plugins to forward log data directly to a number of external
destinations.
FluentBit configuration must be provided the Terraform Enterprise container in a file mounted to the container. That is, the configuration value must point to a filesystem path on the Docker container where the FluentBit configuration is located; the configuration must not contain the actual configuration itself. This means it is the responsibility of the Terraform Enterprise operator to mount the config snippet to the Docker container.
Key | Description | Specific Format Required |
---|---|---|
TFE_LOG_FORWARDING_CONFIG_PATH | Filesystem path on the Terraform Enterprise container containing FluentBit [OUTPUT] configuration | Yes, string. |
Future deprecation
Exposing FluentBit configuration to Terraform Enterprise operators is provided as a convenience to facilitate migration Terraform Enterprise installations. Customers are encouraged to migrate away from relying on injected FluentBit configuration, and provide their own log forwarding and aggregation solution in their infrastructure.Limitations
The FluentBit solution provided in legacy Replicated Terraform Enterprise deployments emitted log entries that contained additional metadata keys, such as hostname and IP address. This allowed for additional observability value from log entries, as operators could identify the source of log entries. Unlike Replicated deployments, logs emitted by the FluentBit plugins made available in Terraform Enterprise Flexible Deployments do not contain additional metadata attached to each log entry. This is due to the isolated nature of the FluentBit process within the Terraform Enterprise Docker container; by definition, processes within the Docker container are not exposed to host-level details.
Because of this, we strongly recommend using an external log forwarding solution that aligns with your existing observability solutions. See external log forwarding for further discussion.
Additionally, note that built-in log forwarding is only available for Docker-deployed Terraform Enterprise installations. Terraform Enterprise deployed on Kubernetes does not support leveraging the built-in FluentBit.
Supported external destinations
You can only forward logs to one of the supported external destinations below. Each supported external destination contains example configuration for convenience.
Amazon CloudWatch
Sending to Amazon CloudWatch is only supported when Terraform Enterprise is located within AWS due to how Fluent Bit reads AWS credentials.
This example configuration forwards all logs to Amazon CloudWatch. Refer to the
cloudwatch_logs
Fluent Bit output plugin documentation
for more information.
Note: In Terraform Enterprise installations using AWS external services,
Fluent Bit will have access to the same AWS_ACCESS_KEY_ID
and
AWS_SECRET_ACCESS_KEY
environment variables that are used for object storage.
Amazon S3
Sending to Amazon S3 is only supported when Terraform Enterprise is located within AWS due to how Fluent Bit reads AWS credentials.
This example configuration forwards all logs to Amazon S3. Refer to the
s3
Fluent Bit output plugin documentation
for more information.
Note: In Terraform Enterprise installations using AWS external services,
Fluent Bit will have access to the same AWS_ACCESS_KEY_ID
and
AWS_SECRET_ACCESS_KEY
environment variables that are used for object storage.
Azure Blob Storage
This example configuration forwards all logs to Azure Blob Storage. Refer to the
azure_blob
Fluent Bit output plugin documentation
for more information.
Azure Log Analytics
This example configuration forwards all logs to Azure Log Analytics. Refer to
the azure
Fluent Bit output plugin documentation
for more information.
Datadog
This example configuration forwards all logs to Datadog. Refer to the
datadog
Fluent Bit output plugin documentation
for more information.
Forward
This example configuration forwards all logs to a listening Fluent Bit or
Fluentd instance. Refer to the
forward
Fluent Bit output plugin documentation
for more information.
Google Cloud Platform Cloud Logging
Sending to Google Cloud Platform Cloud Logging is only supported when Terraform Enterprise is located within GCP due to how Fluent Bit reads GCP credentials.
This example configuration forwards all logs to Google Cloud Platform Cloud
Logging (formerly known as Stackdriver). Refer to the
stackdriver
Fluent Bit output plugin documentation
for more information.
Note: In Terraform Enterprise installations using GCP external services,
Fluent Bit will have access to the GOOGLE_SERVICE_CREDENTIALS
environment
variable that points to a file containing the same GCP Service Account JSON
credentials that are used for object storage.
Splunk Enterprise HTTP Event Collector (HEC)
This example configuration forwards all logs to Splunk Enterprise via the HTTP
Event Collector (HEC) interface. Refer to the
splunk
Fluent Bit output plugin documentation
for more information.
Syslog
This example configuration forwards all logs to a Syslog-compatible endpoint.
Refer to the
syslog
Fluent Bit output plugin documentation
for more information.
Warning
The `syslog_message_key` should not be changed from `message`. If that value is changed, the application will no longer forward logs.