// Gets Vault logs and syslog written to disk, so it is exposed on circle ci artifacts
Gets Vault logs and syslog written to disk, so it is exposed on circle ci artifacts
// Gets Vault logs and syslog written to disk so it is exposed on circle ci artifacts
func writeVaultLogs(t *testing.T, testName string, testDir string) {
	terraformOptions := test_structure.LoadTerraformOptions(t, testDir)
	keyPair := loadKeyPair(t, testDir)
	projectId := test_structure.LoadString(t, WORK_DIR, SAVED_GCP_PROJECT_ID)
	region := test_structure.LoadString(t, WORK_DIR, SAVED_GCP_REGION_NAME)
	instanceGroupName := terraform.OutputRequired(t, terraformOptions, TFOUT_INSTANCE_GROUP_NAME)
	instanceGroup := gcp.FetchRegionalInstanceGroup(t, projectId, region, instanceGroupName)
	instances := getInstancesFromGroup(t, projectId, instanceGroup, 3)
	vaultStdOutLogFilePath := "/opt/vault/log/vault-stdout.log"
	vaultStdErrLogFilePath := "/opt/vault/log/vault-error.log"
	sysLogFilePath := "/var/log/syslog"
	instanceIdToLogs := map[string]map[string]string{}
	for _, instance := range instances {
		instanceName := instance.Name
		instanceIdToLogs[instanceName] = getFilesFromInstance(t, instance, &keyPair, vaultStdOutLogFilePath, vaultStdErrLogFilePath, sysLogFilePath)
		localDestDir := filepath.Join(LOGS_STORAGE_PATH, testName, instanceName)
		if !files.FileExists(localDestDir) {
			os.MkdirAll(localDestDir, 0755)
		}
		writeLogFile(t, instanceIdToLogs[instanceName][vaultStdOutLogFilePath], filepath.Join(localDestDir, "vault-stdout.log"))
		writeLogFile(t, instanceIdToLogs[instanceName][vaultStdErrLogFilePath], filepath.Join(localDestDir, "vault-error.log"))
		writeLogFile(t, instanceIdToLogs[instanceName][sysLogFilePath], filepath.Join(localDestDir, "syslog"))
	}
}
func writeVaultLogs ( t * testing . T , testName string , testDir string ) { terraformOptions := test_structure . LoadTerraformOptions ( t , testDir ) keyPair := loadKeyPair ( t , testDir ) projectId := test_structure . LoadString ( t , WORK_DIR , SAVED_GCP_PROJECT_ID ) region := test_structure . LoadString ( t , WORK_DIR , SAVED_GCP_REGION_NAME ) instanceGroupName := terraform . OutputRequired ( t , terraformOptions , TFOUT_INSTANCE_GROUP_NAME ) instanceGroup := gcp . FetchRegionalInstanceGroup ( t , projectId , region , instanceGroupName ) instances := getInstancesFromGroup ( t , projectId , instanceGroup , 3 ) vaultStdOutLogFilePath := " " vaultStdErrLogFilePath := " " sysLogFilePath := " " instanceIdToLogs := map [ string ] map [ string ] string { } for _ , instance := range instances { instanceName := instance . Name instanceIdToLogs [ instanceName ] = getFilesFromInstance ( t , instance , & keyPair , vaultStdOutLogFilePath , vaultStdErrLogFilePath , sysLogFilePath ) localDestDir := filepath . Join ( LOGS_STORAGE_PATH , testName , instanceName ) if ! files . FileExists ( localDestDir ) { os . MkdirAll ( localDestDir , 0755 ) } writeLogFile ( t , instanceIdToLogs [ instanceName ] [ vaultStdOutLogFilePath ] , filepath . Join ( localDestDir , " " ) ) writeLogFile ( t , instanceIdToLogs [ instanceName ] [ vaultStdErrLogFilePath ] , filepath . Join ( localDestDir , " " ) ) writeLogFile ( t , instanceIdToLogs [ instanceName ] [ sysLogFilePath ] , filepath . Join ( localDestDir , " " ) ) } }
Gets Vault logs and syslog written to disk, so it is exposed on circle ci artifacts
Gets Vault logs and syslog written to disk so it is exposed on circle ci artifacts