Skip to main content
You can use Query History export to bring Query History data to an external monitoring solution for further analysis. In this recipe, we will show you how to export Query History data to Amazon S3, and then analyze it using Cube by reading the data from S3 using DuckDB.

Configuration

Vector configuration for exporting Query History to Amazon S3 and also outputting it to the console of the Vector agent in your Cube Cloud deployment. In the example below, we are using the aws_s3 sink to export the cube-query-history-export-demo bucket in Amazon S3, but you can use any other storage solution that Vector supports.
You’d also need to set the following environment variables in the Settings → Environment variables page of your Cube Cloud deployment:

Data modeling

Example data model for analyzing data from Query History export that is brought to a bucket in Amazon S3. The data is accessed directly from S3 using DuckDB. With this data model, you can run queries that aggregate data by dimensions such as status, environment_name, api_type, etc. and also calculate metrics like count, total_duration, or avg_duration:

Result

Example query in Playground: