You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, there are many indices which grouped by versioning (naming convention). When I use metrics elasticsearch_indices_store_size_bytes_total for monitoring index store size, I only want to know the current using index(not old versions). In that case, the current using index has an alias. The old index doesn't have. If there is such label in this metrics. I could use it as following: elasticsearch_indices_store_size_bytes_total{alias="my-alias"}
Since the index name will be changed automatically, I don't need to change the index name in this metrics. Thus, I don't need to change the query expression again and again.
The text was updated successfully, but these errors were encountered:
This is not exactly per alias, but it could help to get the desired data (for anyone hitting this in the future). We can use the label_replace function to extract the interesting part from the index name and group by that.
For instance, with daily indices, we always have something like: my-index-2024.02.02. In this case, we want to aggregate the common part of all those indices (my-index).
sum by (pattern) (
label_replace(
sum by (index) (
elasticsearch_indices_store_size_bytes_total
),
"pattern",
"$1",
"index",
"(.*)_[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}$"
)
)
You may need to tweak the regex to extract the pattern from the index label.
Sometimes, there are many indices which grouped by versioning (naming convention). When I use metrics
elasticsearch_indices_store_size_bytes_total
for monitoring index store size, I only want to know the current using index(not old versions). In that case, the current using index has an alias. The old index doesn't have. If there is such label in this metrics. I could use it as following:elasticsearch_indices_store_size_bytes_total{alias="my-alias"}
Since the index name will be changed automatically, I don't need to change the index name in this metrics. Thus, I don't need to change the query expression again and again.
The text was updated successfully, but these errors were encountered: