# Creating rollover alias to only point to the current day?

**URL:** https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265
**Category:** Index Management
**Created:** [October 10, 2025, 11:54am UTC](https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265 "2025-10-10T11:54:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![OpenAndreas](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@OpenAndreas](https://forum.opensearch.org/u/OpenAndreas)
#### Post date: [October 10, 2025, 11:54am UTC](https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265/1 "2025-10-10T11:54:44Z")

</div>

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

**Describe the issue** : I would like to create an alias containing only the logs of “today”. So I need an alias containing exactly one index for today like “logs-today” pointing to index “logs-2025-10-10”, and that this alias will point to exactly one index tomorrow, ie. then to “logs-2025-10-11”. Currently newly created indices can be added but not old ones removed.

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

### Author: ![Anthony](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/anthony/32/9939_2.png) [@Anthony](https://forum.opensearch.org/u/Anthony)
#### Post date: [October 10, 2025, 1:48pm UTC](https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265/2 "2025-10-10T13:48:12Z")

</div>

@OpenAndreas Great question, there is no built in way to achieve this currently, You would need to create a cron/scheduled task to execute script similar to the following:

```auto
export TZ=Europe/Dublin
today=$(date +%F); yday=$(date -v-1d +%F) \
&& curl -k -u admin:admin -H 'Content-Type: application/json' -XPOST 'https://localhost:9200/_aliases' -d "{
  \"actions\": [
    { \"remove\": { \"index\": \"logs-${yday}\", \"alias\": \"logs-today\" } },
    { \"add\": { \"index\": \"logs-${today}\", \"alias\": \"logs-today\" } }
  ]
}"

```

---

<div class="post-metadata">

### Author: ![OpenAndreas](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@OpenAndreas](https://forum.opensearch.org/u/OpenAndreas)
#### Post date: [October 10, 2025, 2:03pm UTC](https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265/3 "2025-10-10T14:03:16Z")

</div>

Yes, I had that thought, too. This just feels like a workaround. But I will go this path if no solution within Opensearch shows up.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)
#### Post date: [December 9, 2025, 2:03pm UTC](https://forum.opensearch.org/t/creating-rollover-alias-to-only-point-to-the-current-day/27265/4 "2025-12-09T14:03:23Z")

</div>

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