# S3 dynamic date prefix in folder name by using current date as backup\_add\_prefix

**URL:** <https://discuss.elastic.co/t/s3-dynamic-date-prefix-in-folder-name-by-using-current-date-as-backup-add-prefix/215104>\
**Category:** Logstash\
**Created:** [January 15, 2020, 9:32am UTC](https://discuss.elastic.co/t/s3-dynamic-date-prefix-in-folder-name-by-using-current-date-as-backup-add-prefix/215104 "2020-01-15T09:32:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xandr90](https://avatars.discourse-cdn.com/v4/letter/x/dfb087/32.png) [@Xandr90](https://discuss.elastic.co/u/Xandr90)\
**Post date:** [January 15, 2020, 9:32am UTC](https://discuss.elastic.co/t/s3-dynamic-date-prefix-in-folder-name-by-using-current-date-as-backup-add-prefix/215104/1 "2020-01-15T09:32:35Z")

</div>

So what i want to do is use Logstash to rename incoming files in a s3 bucket.

I run it via docker and use the following logstash.conf

> input {  
> s3 {  
> access\_key\_id =\> "some\_key"  
> secret\_access\_key =\> "some\_secret"  
> region =\> "some\_region"  
> bucket =\> "mybucket"  
> interval =\> "10"  
> sincedb\_path =\> "/tmp/sincedb\_something"  
> backup\_add\_prefix =\>'%{+YYYY.MM.dd}/'  
> backup\_to\_bucket =\> "mybucket"  
> additional\_settings =\> {  
> force\_path\_style =\> true  
> follow\_redirects =\> false  
> }  
> }  
> }

Basically i want backup\_add\_prefix =\>'%{+YYYY.MM.dd}/' to be the current date, so that logstash builds a structure where incoming files a put into date folders.  
The syntax does not work though. Is there a way to make backup\_add\_prefix a changing date?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [January 15, 2020, 3:38pm UTC](https://discuss.elastic.co/t/s3-dynamic-date-prefix-in-folder-name-by-using-current-date-as-backup-add-prefix/215104/2 "2020-01-15T15:38:53Z")

</div>

No, the [code](https://github.com/logstash-plugins/logstash-input-s3/blob/ba9b5fcbf1b1dd29122087c3b9aaace0ea531ae7/lib/logstash/inputs/s3.rb#L155) uses string interpolation to prefix the name. It does not sprintf it.

---

<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:** [February 12, 2020, 3:38pm UTC](https://discuss.elastic.co/t/s3-dynamic-date-prefix-in-folder-name-by-using-current-date-as-backup-add-prefix/215104/3 "2020-02-12T15:38:54Z")

</div>

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