Introduction
Docker supports a variety of logging drivers that allow you to forward container logs to an external source, such as syslog. You can review the official list of Docker logging drivers to see all available options.
This guide provides two methods for configuring log forwarding for Terraform Enterprise Flexible Deployment Option (FDO) containers.
Expected Outcome
After completing the procedure, logs from the Terraform Enterprise FDO container will be forwarded to an external location specified by your chosen Docker logging driver configuration.
Prerequisites
- An operational Terraform Enterprise FDO instance running on Docker.
Procedure
This article presents two options for configuring log forwarding. You only need to follow one.
Option 1: Configure the Docker Daemon
This method configures the Docker daemon to apply the logging driver to all containers on the host by default.
-
Add the logging driver configuration to the
/etc/docker/daemon.jsonfile. If the file does not exist, you may need to create it.{ "log-driver": "syslog", "log-opts": { "syslog-address": "udp://<ip_address_your_syslog_server>:514", "syslog-format": "rfc3164", "tag": "{{.ImageName}}/{{.Name}}/{{.ID}}" } } -
Restart the Docker service to apply the changes. This action will stop all running containers.
# systemctl restart docker
After the service restarts, all containers on the host will use the configured logging driver by default.
Option 2: Configure via Docker Compose
This method applies the logging driver configuration only to the Terraform Enterprise container defined in your docker-compose.yaml file.
-
Modify your
compose.yamlfile to include theloggingconfiguration block within thetfeservice definition.logging: driver: syslog options: syslog-address: "udp://<ip_address_your_syslog_server>:514"The following example shows the complete
compose.yamlfile with the logging configuration.version: "3.9" name: terraform-enterprise services: tfe: image: images.releases.hashicorp.com/hashicorp/terraform-enterprise:v202406-1 logging: driver: syslog options: syslog-address: "udp://<ip_address_your_syslog_server>:514" -
Restart the container to apply the new configuration.
$ docker compose down $ docker compose up --detach
Additional Information
- For more details, refer to the official documentation on External Log Forwarding for Terraform Enterprise.
- The official Docker documentation for logging drivers provides comprehensive information on all available drivers and options.