# S3 output plugin prefix string interpolation

**URL:** <https://discuss.elastic.co/t/s3-output-plugin-prefix-string-interpolation/84455>\
**Category:** Logstash\
**Created:** [May 3, 2017, 8:24pm UTC](https://discuss.elastic.co/t/s3-output-plugin-prefix-string-interpolation/84455 "2017-05-03T20:24:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlorinAndrei](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@FlorinAndrei](https://discuss.elastic.co/u/FlorinAndrei)\
**Post date:** [May 3, 2017, 8:24pm UTC](https://discuss.elastic.co/t/s3-output-plugin-prefix-string-interpolation/84455/1 "2017-05-03T20:24:08Z")

</div>

With the current Logstash version (5.3), and the S3 output plugin, I see the prefix option "supports string interpolation". My question is, can I interpolate based on current date/time, with multiple levels of directories, like this:

```
s3 {
  prefix => "logstash-test/%{+YYYY}/%{+MM}/%{dd}/"
}

```

Or am I restricted to string interpolation based strictly on simple field values like this:

```
s3 {
  prefix => "logstash-test/%{event}/"
}
```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 6, 2017, 7:19pm UTC](https://discuss.elastic.co/t/s3-output-plugin-prefix-string-interpolation/84455/2 "2017-05-06T19:19:53Z")

</div>

> My question is, can I interpolate based on current date/time, with multiple levels of directories, like this:

Yes, depending on what you mean by "current". `%{+YYYY}` and friends always look at the event's timestamp (the `@timestamp` field).

---

<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:** [June 3, 2017, 7:35pm UTC](https://discuss.elastic.co/t/s3-output-plugin-prefix-string-interpolation/84455/3 "2017-06-03T19:35:01Z")

</div>

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