# Use s3 backup\_bucket option and create folder structure dynamically

**URL:** <https://discuss.elastic.co/t/use-s3-backup-bucket-option-and-create-folder-structure-dynamically/210797>\
**Category:** Logstash\
**Created:** [December 6, 2019, 12:59am UTC](https://discuss.elastic.co/t/use-s3-backup-bucket-option-and-create-folder-structure-dynamically/210797 "2019-12-06T00:59:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user2416](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@user2416](https://discuss.elastic.co/u/user2416)\
**Post date:** [December 6, 2019, 12:59am UTC](https://discuss.elastic.co/t/use-s3-backup-bucket-option-and-create-folder-structure-dynamically/210797/1 "2019-12-06T00:59:32Z")

</div>

Hi,

I am trying to read AWS cloudtrail logs stored in S3 bucket in the below folder structure  
`AWSLogs/accountnumber/CloudTrail/region/year/month/day` and send the processed files to the backup S3 bucket using s3 `backup_bucket` option. But I want to store the backup files also in the same folder structure, since there will be lot of regions i cannot create individual config file for each region. Is there any way to get the region dynamically and use it in backup\_add\_prefix option?

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 3, 2020, 12:59am UTC](https://discuss.elastic.co/t/use-s3-backup-bucket-option-and-create-folder-structure-dynamically/210797/2 "2020-01-03T00:59:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
