From 002be62bb73da101b8e2e9478aa71248bb073726 Mon Sep 17 00:00:00 2001 From: Anthony Woods Date: Mon, 18 Dec 2023 05:49:49 +0000 Subject: [PATCH] Update ad_hoc_metric.md fix query to correctly show per-minute count of requests instead of the count per 5minutes --- ad_hoc_metric.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ad_hoc_metric.md b/ad_hoc_metric.md index b4d26da..66e9d9a 100644 --- a/ad_hoc_metric.md +++ b/ad_hoc_metric.md @@ -6,8 +6,8 @@ 2. Run the query `{filename="/var/log/nginx/json_access.log"} |= "Googlebot"` for the last 5 minutes, notice you get json log lines of googlebot requests. Click a log line to see it’s details. 3. Query time labels extraction - We use the JSON parser to extract the HTTP status code from the raw log line. - - Run the following request to get the amount of Googlebot requests per minute, split out by statuscode: `sum by (status) (count_over_time({filename="/var/log/nginx/json_access.log"} |= "Googlebot" | json [5m]))` - - Run the following request to get the amount of requests per minute, split out by http_method `sum by (request_method) (count_over_time({filename="/var/log/nginx/json_access.log"} | json [5m]))` + - Run the following request to get the amount of Googlebot requests per minute, split out by statuscode: `sum by (status) (count_over_time({filename="/var/log/nginx/json_access.log"} |= "Googlebot" | json [1m]))` + - Run the following request to get the amount of requests per minute, split out by http_method `sum by (request_method) (count_over_time({filename="/var/log/nginx/json_access.log"} | json [1m]))` ## Write LogQL Metric queries with the explorer view: Query time metrics extraction