Simplified PromQL querying can only be used to query metrics
For querying logs, please use one of our other options
Create your first chart using a PromQL query. Start by creating a dashboard in Dashboards → Create dashboard.
Create a new chart on your dashboard and use a query like the one below:
avg(rate(http_requests_total))
For querying logs, please use one of our other options
PromQL (Prometheus Query Language) is designed for querying time series data. In Betterstack, we've adapted a subset of PromQL to work with log data, allowing you to leverage some of your existing PromQL knowledge. Note that our implementation currently has some limitations:
rate()
.Betterstack supports the following PromQL operations:
{label="value"}
)by
and without
clausesrate()
functionAggregation operators include:
sum
: Calculate the sum of elements in the vectoravg
: Calculate the average of elements in the vectormin
: Select the minimum element of the vectormax
: Select the maximum element of the vectorcount
: Count the number of elements in the vectortopk
: Select the k largest elements of the vectorbottomk
: Select the k smallest elements of the vectorSee the examples below for full queries using PromQL in Betterstack.
sum by (method) (rate(http_requests_total))
This query returns the rate of HTTP requests, grouped by HTTP method.
rate(container_cpu_usage_seconds_total{container!=""}) without (id)
This query returns the per-second rate of CPU usage over the last 15 minutes for each pod, excluding the "id" label.
avg by (instance) (rate(process_resident_memory_bytes))
This query calculates the average per-second rate of memory usage for each instance.
topk(5, sum by (endpoint) (rate(api_requests_total)))
This query returns the top 5 API endpoints with the highest per-second request rate.
sum by (interface) (rate(network_transmit_bytes_total))
This query returns the per-second rate of network transmission (in bytes), grouped by network interface.
Please let us know at hello@betterstack.com.
We're happy to help! 🙏