diff --git a/init/fluent_bit_init_process.go b/init/fluent_bit_init_process.go index afff69863..b65161d41 100644 --- a/init/fluent_bit_init_process.go +++ b/init/fluent_bit_init_process.go @@ -195,17 +195,20 @@ func processConfigFile(path string) { } } -func getS3ConfigFile(arn string) string { +func getS3ConfigFile(userInput string) string { // Preparation for downloading S3 config files if !s3ClientCreated { createS3Client() } // e.g. "arn:aws:s3:::user-bucket/s3_parser.conf" - arnBucketFile := arn[13:] - bucketAndFile := strings.SplitN(arnBucketFile, "/", 2) + s3ARN, err := arn.Parse(userInput) + if err != nil { + logrus.Fatalf("[FluentBit Init Process] Could not parse arn: %s\n", userInput) + } + bucketAndFile := strings.SplitN(s3ARN.Resource, "/", 2) if len(bucketAndFile) != 2 { - logrus.Fatalf("[FluentBit Init Process] Unrecognizable arn: %s\n", arn) + logrus.Fatalf("[FluentBit Init Process] Could not parse arn: %s\n", userInput) } bucketName := bucketAndFile[0]