diff --git a/templates/packer/ansible/roles/common/files/worker-initialization-scripts/vector.sh b/templates/packer/ansible/roles/common/files/worker-initialization-scripts/vector.sh index 7cc1f7b1a6..9bb0f4617c 100755 --- a/templates/packer/ansible/roles/common/files/worker-initialization-scripts/vector.sh +++ b/templates/packer/ansible/roles/common/files/worker-initialization-scripts/vector.sh @@ -7,19 +7,23 @@ echo "Writing vector config." REGION=$(curl -Ls http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region) sudo mkdir -p /etc/vector -sudo tee /etc/vector/vector.toml > /dev/null << EOF -[sources.journald] -type = "journald" -exclude_units = ["vector.service"] - -[sinks.out] -type = "aws_cloudwatch_logs" -inputs = [ "journald" ] -region = "${REGION}" -endpoint = "${CLOUDWATCH_LOGS_ENDPOINT_URL}" -group_name = "${CLOUDWATCH_LOG_GROUP}" -stream_name = "worker_syslog_{{ host }}" -encoding.codec = "json" +sudo tee /etc/vector/vector.yaml > /dev/null << EOF +sources: + journald: + type: journald + exclude_units: + - vector.service +sinks: + out: + type: aws_cloudwatch_logs + inputs: + - journald + region: ${REGION} + endpoint: ${CLOUDWATCH_LOGS_ENDPOINT_URL} + group_name: ${CLOUDWATCH_LOG_GROUP} + stream_name: worker_syslog_{{ host }} + encoding: + codec: json EOF sudo systemctl enable --now vector