Query the information about non-200 requests
Keyword
NGINX access analysis, general aggregate analysis, error analysis
correlation function
round,compare,count_if,count
Use the count_if function to calculate the failure ratio by dividing the number of requests for which the status code is greater than 200 by the total number of requests. Use the compare function to compare the failure ratio in the current period with the result 86,400 seconds ago. An array is returned, which contains the current value, the value 86,400 seconds ago, and the ratio of the first value to the second value in sequence. The results are displayed in a single value chart, in which the display value represents the value of today and the comparison value represents the growth.
SQL
* |
select
round(diff [1], 2) as today,
round((diff [3] -1.0) * 100, 2) as growth
FROM
(
SELECT
compare(fail, 86400) as diff
from
(
select
count_if(status > 200) * 1.0 / count(1) as fail
from
log
)
)