# Can Snapshots save index in a limited time

**URL:** https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553
**Category:** Kibana
**Tags:** slm-snapshot-lifecycle-management
**Created:** [May 16, 2023, 10:00am UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553 "2023-05-16T10:00:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Skairik](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@Skairik](https://discuss.elastic.co/u/Skairik)
#### Post date: [May 16, 2023, 10:00am UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/1 "2023-05-16T10:00:17Z")

</div>

Hello everyone,  
I would like to know if it is possible to set up a snapshot policy that retrieves for example indexes only from the last 7 days. For example, I save my logs from my active directory with this format:

```auto
index => "winlogbeat-%{+YYYY.MM.dd}"

```

And I wanted to use this to recover that the last 7 daysI tested a few things with the settings like this:

```auto
PUT /_slm/policy/snap-hebdo-ad
{
  "schedule": "0 0 1 * * ?", 
  "name": "snap-hebdo-ad", 
  "repository": "AD", 
  "config": {
    "indices": [
      "winlogbeat-*"
    ],
    "metadata": {
      "taken_at": "now-7d/d"
    },
    "ignore_unavailable": true,
    "include_global_state": false,
    "partial": true
  },
  "retention": {
    "expire_after": "60d",
    "min_count": 1,
    "max_count": 10
  }
}

```

But nothing worked (it saves every winlobeat-\*), so I would like to know already if what I am asking for is possible, and if it is, how!

---

<div class="post-metadata">

### Author: ![FALEN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/falen/32/82754_2.png) [@FALEN](https://discuss.elastic.co/u/FALEN)
#### Post date: [May 16, 2023, 10:15am UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/2 "2023-05-16T10:15:01Z")

</div>

If your concern is storage usage, below should answer that;

> ## How snapshots work [(here)](https://github.com/elastic/elasticsearch/edit/8.7/docs/reference/snapshot-restore/index.asciidoc)
> 
> Snapshots are automatically deduplicated to save storage space and reduce network transfer costs. To back up an index, a snapshot makes a copy of the index’s [segments](https://www.elastic.co/guide/en/elasticsearch/reference/current/near-real-time.html) and stores them in the snapshot repository. Since segments are immutable, **the snapshot only needs to copy any new segments created since the repository’s last snapshot**.
> 
> Each snapshot is also logically independent. When you delete a snapshot, Elasticsearch only deletes the segments used exclusively by that snapshot. Elasticsearch doesn’t delete segments used by other snapshots in the repository.

If your concern is restore process, you can select indices manually while restoring snapshot. You don't need to restore all

---

<div class="post-metadata">

### Author: ![Skairik](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@Skairik](https://discuss.elastic.co/u/Skairik)
#### Post date: [May 16, 2023, 10:29am UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/3 "2023-05-16T10:29:29Z")

</div>

Thanks for the reply,

My concern is the use of storage, but the following information does not allow me to answer my question unless the answer is no since I have not seen what I am looking for anywhere.

---

<div class="post-metadata">

### Author: ![FALEN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/falen/32/82754_2.png) [@FALEN](https://discuss.elastic.co/u/FALEN)
#### Post date: [May 16, 2023, 10:48am UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/4 "2023-05-16T10:48:17Z")

</div>

As noted above, ALL Elasticsearch snapshots are similiar to incremental. Basically the cluster (actually each node) looks at what segments it has to snapshot vs. what segments are already in the repository, and writes the missing ones. Plus a bunch of references, states, and other metadata. That’s it.

So, if you have daily, weekly snapshot jobs scheduled. You should not concern storage. Because storage used will not multiple with each snapshot data

---

<div class="post-metadata">

### Author: ![Skairik](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@Skairik](https://discuss.elastic.co/u/Skairik)
#### Post date: [May 16, 2023, 12:04pm UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/5 "2023-05-16T12:04:17Z")

</div>

Aaah! Actually present it this way is more logical, I thought badly because my first goal was to retrieve only my logs from last week and leave the others because they were test logs and were going to be deleted. 🫠  
But if we remove this exceptional case indeed, you are right, given how the snapshot system works, I do not need to try to recover only certain logs. 😅

Thanks for the reply again !

---

<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 13, 2023, 12:04pm UTC](https://discuss.elastic.co/t/can-snapshots-save-index-in-a-limited-time/333553/6 "2023-06-13T12:04:42Z")

</div>

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