Hi!
I've posted this question on SO: elastic stack - Elasticsearch how to set alert on total size of indices matching a pattern? - Stack Overflow but am re-posting it here in hopes to get a more focused audience ![]()
I would like to set an Alert Rule in Elastic - to trigger an alert when a total size of indices, matching a specific pattern, exceeds some limit.
I know how to get the total size by running a query:
GET /.ds-elastic-cloud-logs*/_stats
this would give me:
...
"_all": {
"primaries": {
"docs": {
"count": 12865686,
"deleted": 0
},
"shard_stats": {
"total_count": 5
},
"store": {
"size_in_bytes": 2205540490,
"total_data_set_size_in_bytes": 2205540490,
"reserved_in_bytes": 0
},
...
and the value I'm looking for is: "size_in_bytes": 2205540490
But I could not find how to create an alert based on this value...
I looked at the "index threshold" type of alerts: Index threshold | Kibana Guide [master] | Elastic - and while I am able to specify the index pattern (.ds-elastic-cloud-logs*) in the rule - the "size-in-bytes" field is not available for use in the alert...
Also looked at the "elasticsearch query" type of alerts: Elasticsearch query | Kibana Guide [master] | Elastic - but I can only get a count of documents returned by a query to be used as the metric, not the size of indices ...
Any other way to achieve what I want?
Thank you!
Marina