# Output file to create based on timestamp

**URL:** <https://discuss.elastic.co/t/output-file-to-create-based-on-timestamp/150880>\
**Category:** Logstash\
**Created:** [October 3, 2018, 12:07pm UTC](https://discuss.elastic.co/t/output-file-to-create-based-on-timestamp/150880 "2018-10-03T12:07:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkshara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkshara/32/48222_2.png) [@pkshara](https://discuss.elastic.co/u/pkshara)\
**Post date:** [October 3, 2018, 12:07pm UTC](https://discuss.elastic.co/t/output-file-to-create-based-on-timestamp/150880/1 "2018-10-03T12:07:36Z")

</div>

Hi Team,

Please suggest for the below query,

input  
{ }  
filter { }  
output  
{  
file  
{  
path =\> "tmp/path/output-%{+YYYY-MM-dd}"  
}  
}

This would create an output file based on the day wise / everyday new text file will be created.  
Is there any way to create a output file based on x days.  
Ex. if i want to create an output file for every 3 days. where should i give the condition and how.

TIA

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [October 4, 2018, 12:02pm UTC](https://discuss.elastic.co/t/output-file-to-create-based-on-timestamp/150880/2 "2018-10-04T12:02:19Z")

</div>

I've looked at this before as well and the closest thing I could find was this:

> [@\[Solved\] Weekly indexes instead of daily](https://discuss.elastic.co/t/solved-weekly-indexes-instead-of-daily/56871):
>
> Right now I am working with indexes that are created daily using the following output in my config file: output { elasticsearch { hosts =\> ["localhost:9200"] index =\> "logstash-events-%{+YYYY.MM.dd}" } } This is fine, but I was wondering if it is possible to have it make new indexes every week.

---

<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:** [November 1, 2018, 12:02pm UTC](https://discuss.elastic.co/t/output-file-to-create-based-on-timestamp/150880/3 "2018-11-01T12:02:20Z")

</div>

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