ves-io-schema-log-CustomAPI-AccessLogAggregationQuery

Examples of performing log CustomAPI AccessLogAggregationQuery

Usecase:

Access Log Aggregation query for virtual host vhost1 in namespace ns1

Request:

Request using vesctl:

vesctl request rpc log.CustomAPI.AccessLogAggregationQuery -i request.yaml --uri /public/namespaces/ns1/access_logs --http-method POST

where file request.yaml has following contents:

aggs:
  country:
    fieldAggregation:
      field: COUNTRY
      topk: 3
  date_histogram:
    dateAggregation:
      step: 1h
endTime: "1591131600"
query: '{vh_name="vhost1"}'
startTime: "1591120800"

vesctl yaml response:

aggs: {}

Request using curl:

curl -X 'POST' -d '{"query":"{vh_name="vhost1"}","startTime":"1591120800","endTime":"1591131600","aggs":{"country":{"fieldAggregation":{"field":"COUNTRY","topk":3}},"date_histogram":{"dateAggregation":{"step":"1h"}}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build743694289_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/data/namespaces/ns1/access_logs'

curl response:

HTTP/1.1 200 OK
Content-Length: 76
Content-Type: application/json
Date: Thu, 02 Jul 2020 15:53:12 GMT
Vary: Accept-Encoding

{
  "logs": [
  ],
  "total_hits": "0",
  "aggs": {
  },
  "scroll_id": ""
}