Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ad_hoc_metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down