​
Select Service
ves-io-schema-alert-CustomAPI-AlertsHistoryAggregation
Published April 5, 2023 | Last modified May 29, 2026
Examples of performing alert CustomAPI AlertsHistoryAggregation
Usecase:
Alerts History Aggregation request`
Request:
Request using vesctl:
vesctl request rpc alert.CustomAPI.AlertsHistoryAggregation -i request.yaml --uri /public/namespaces/system/alerts/history/aggregation --http-method POST
where file request.yaml has following contents:
aggs: date_histogram: dateAggregation: step: 1h site: fieldAggregation: field: SITE topk: 3 unique_identifiers: cardinalityAggregation: field: IDENTIFIERendTime: "1591131600"filter: '{severity="critical"}'startTime: "1591120800"vesctl yaml response:
aggs: date_histogram: dateAggregation: buckets: - count: "224" subAggs: {} time: "1591120800000" - count: "533" subAggs: {} time: "1591124400000" - count: "525" subAggs: {} time: "1591128000000" site: fieldAggregation: buckets: - count: "456" key: site-1 subAggs: {} - count: "230" key: site-2 subAggs: {} - count: "45" key: site-3 subAggs: {} unique_identifiers: cardinalityAggregation: count: "10"totalHits: "1282"Request using curl:
curl -X 'POST' -d '{"filter":"{severity=\"critical\"}","start_time":"1591120800","end_time":"1591131600","aggs":{"date_histogram":{"date_aggregation":{"step":"1h"}},"site":{"field_aggregation":{"field":"SITE","topk":3}},"unique_identifiers":{"cardinality_aggregation":{"field":"IDENTIFIER"}}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_var_folders_q2_3kp8z3zs0x5_m7pk1bgb0_ph0000gp_T_go-build1414723615_b001_apidocs.test/host=MTY6VVHQPH/svc=S:examplesvc/site=mytestce01' 'https://acmecorp.console.ves.volterra.io/api/data/namespaces/system/alerts/history/aggregation'curl response:
HTTP/1.1 200 OKContent-Type: application/jsonDate: Mon, 13 Apr 2026 01:58:58 GMTVary: Accept-Encoding
{ "total_hits": "1282", "aggs": { "date_histogram": { "date_aggregation": { "buckets": [ { "time": "1591120800000", "count": "224", "sub_aggs": { }, "trend_value": null }, { "time": "1591124400000", "count": "533", "sub_aggs": { }, "trend_value": null }, { "time": "1591128000000", "count": "525", "sub_aggs": { }, "trend_value": null } ], "step": "" }, "field_aggregation": null, "multi_field_aggregation": null, "cardinality_aggregation": null, "metrics_aggregation": null, "max_aggregation": null, "min_aggregation": null, "avg_aggregation": null, "filter_aggregation": null, "multi_filter_aggregation": null }, "site": { "date_aggregation": null, "field_aggregation": { "buckets": [ { "key": "site-1", "count": "456", "sub_aggs": { }, "trend_value": null, "order_by": null }, { "key": "site-2", "count": "230", "sub_aggs": { }, "trend_value": null, "order_by": null }, { "key": "site-3", "count": "45", "sub_aggs": { }, "trend_value": null, "order_by": null } ] }, "multi_field_aggregation": null, "cardinality_aggregation": null, "metrics_aggregation": null, "max_aggregation": null, "min_aggregation": null, "avg_aggregation": null, "filter_aggregation": null, "multi_filter_aggregation": null }, "unique_identifiers": { "date_aggregation": null, "field_aggregation": null, "multi_field_aggregation": null, "cardinality_aggregation": { "count": "10", "trend_value": null }, "metrics_aggregation": null, "max_aggregation": null, "min_aggregation": null, "avg_aggregation": null, "filter_aggregation": null, "multi_filter_aggregation": null } }}