# I want to archive my old logs to s3 bucket. Currently I'm using docker-compose for the opensearch setup. Can anyone help on this please

**URL:** <https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160>\
**Category:** OpenSearch\
**Tags:** configure, feature-request\
**Created:** [December 19, 2023, 2:04pm UTC](https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160 "2023-12-19T14:04:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aravindasamy](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@aravindasamy](https://forum.opensearch.org/u/aravindasamy)\
**Post date:** [December 19, 2023, 2:04pm UTC](https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160/1 "2023-12-19T14:04:34Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
v 2.8.0

**Describe the issue** :  
No issue. Looking for option to archive old logs to s3 bucket

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![gaobinlong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gaobinlong/32/5242_2.png) [@gaobinlong](https://forum.opensearch.org/u/gaobinlong)\
**Post date:** [December 20, 2023, 4:51am UTC](https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160/2 "2023-12-20T04:51:20Z")

</div>

Do you want to backup the old indices in your OpenSearch cluster to S3? If so you can take a look at this document: [Take and restore snapshots - OpenSearch documentation](https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/snapshots/snapshot-restore/#amazon-s3). Firstly, setup the env to register a s3 repository, and then call the snapshot API of OpenSearch to backup the data of the old indices to s3.

---

<div class="post-metadata">

**Author:** ![aravindasamy](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@aravindasamy](https://forum.opensearch.org/u/aravindasamy)\
**Post date:** [December 20, 2023, 6:24am UTC](https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160/3 "2023-12-20T06:24:22Z")

</div>

Hey thanks for the reply. I have enabled the snapshot and registered s3 repo. My requirement is to have take snapshot of the indices that is 50 days old and push it to s3 repo. I cannot see the option where we can specify the snapshot for 50 days old log.

---

<div class="post-metadata">

**Author:** ![gaobinlong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gaobinlong/32/5242_2.png) [@gaobinlong](https://forum.opensearch.org/u/gaobinlong)\
**Post date:** [December 20, 2023, 7:19am UTC](https://forum.opensearch.org/t/i-want-to-archive-my-old-logs-to-s3-bucket-currently-im-using-docker-compose-for-the-opensearch-setup-can-anyone-help-on-this-please/17160/4 "2023-12-20T07:19:36Z")

</div>

You can use ISM to do that, define a policy that takes snapshot for the 50 days old indices, just like this:

```auto
{
    "id": "test33",
    "seqNo": 246143,
    "primaryTerm": 105,
    "policy": {
        "policy_id": "test33",
        "description": "A sample description of the policy",
        "last_updated_time": 1703056414992,
        "schema_version": 18,
        "error_notification": null,
        "default_state": "init",
        "states": [
            {
                "name": "init",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "snapshot",
                        "conditions": {
                            "min_index_age": "50d"
                        }
                    }
                ]
            },
            {
                "name": "snapshot",
                "actions": [
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "snapshot": {
                            "repository": "example-repository",
                            "snapshot": "example-snapshot"
                        }
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "myindex-*"
                ],
                "priority": 1,
                "last_updated_time": 1703056386362
            }
        ]
    }
}

```

, take a look at the documentation of ISM: [Policies - OpenSearch documentation](https://opensearch.org/docs/latest/im-plugin/ism/policies/#snapshot)
