# Setting elasticsearch monitoring history duration using API

**URL:** https://discuss.elastic.co/t/setting-elasticsearch-monitoring-history-duration-using-api/139085
**Category:** Elasticsearch
**Created:** [July 9, 2018, 6:10am UTC](https://discuss.elastic.co/t/setting-elasticsearch-monitoring-history-duration-using-api/139085 "2018-07-09T06:10:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Dheeraj\_Gupta](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@Dheeraj\_Gupta](https://discuss.elastic.co/u/Dheeraj_Gupta)
#### Post date: [July 9, 2018, 6:10am UTC](https://discuss.elastic.co/t/setting-elasticsearch-monitoring-history-duration-using-api/139085/1 "2018-07-09T06:10:05Z")

</div>

I am using Elasticsearch-6.3.0 with (default) basic license. I have enabled monitoring but would like to keep monitoring indices for less than default `7d`. I tried to update the `xpack.monitoring.history.duration` setting as described in [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/monitoring-settings.html#monitoring-collection-settings) and it looks like the setting was updated successfully. Here are my current settings:

```
$ curl -X GET "esmasters:9200/_cluster/settings?pretty"
{
  "persistent" : {
    "cluster" : {
      "routing" : {
        "allocation" : {
          "enable" : "all"
        }
      }
    },
    "xpack" : {
      "monitoring" : {
        "collection" : {
          "enabled" : "true",
          "indices" : ""
        },
        "history" : {
          "duration" : "4d"
        }
      }
    }
  },
  "transient" : {
    "cluster" : {
      "routing" : {
        "allocation" : {
          "enable" : "all"
        }
      }
    }
  }
}

```

Despite this setting, the indices are retained for 7 days only. I found [an older post](https://discuss.elastic.co/t/xpack-monitoring-history-duration-doesnt-work/88622) which stated that setting has no effect under basic license. However, it was for older version of X-pack.

1. Can we not change the `history.duration` setting if we have a (default) basic license with ElasticStack 6.3.0 or newer?
2. Does this setting not work through Elasticsearch cluster update API and must it be done on each node?

I feel current docs can be modified to explain these two points better

---

<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: [August 6, 2018, 6:10am UTC](https://discuss.elastic.co/t/setting-elasticsearch-monitoring-history-duration-using-api/139085/2 "2018-08-06T06:10:06Z")

</div>

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