Introduction
Docker supports a multitude of logging drivers. See the Docker logging driver list for what options are available. With these options you can forward your Terraform Enterprise - FDO logs to an external source like syslog for example
Expected Outcome
Logs of Terraform Enterprise - FDO container are forwarded to an external location specified by the Docker logging driver
Prerequisites
- Terraform Enterprise - FDO running on docker
Procedure
Option 1:
Alter the docker daemon to have the logging driver configuration
- Add the following to the file /etc/docker/daemon.json
{
"log-driver": "syslog",
"log-opts": {
"syslog-address": "udp://<ip_address_your_syslog_server>:514",
"syslog-format": "rfc3164",
"tag": "{{.ImageName}}/{{.Name}}/{{.ID}}"
}
}
- Restart the docker server. This will also stop all running containers
systemctl restart docker
- All containers should now by default use the logging driver
Option 2:
Alter the Docker compose file for Terraform Enterprise and add the logging driver details
- Alter your compose.yaml file and add the following content
logging:
driver: syslog
options:
syslog-address: "udp://<ip_address_your_syslog_server>:514"
- This looks like below in a complete yaml file
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://10.114.1.23:514"
- Restart the container to enable the new changes
docker compose down
docker compose up --detach