Calculate Availability of Percentage

I have measurement called “weblog_requests”. I want to calculate availability %
the field resp_code is a number it stores http request code. the formula i am looking is

number of successful requests = requests with status code 2xx,3xx,4xx
number of failed requests = requests with status code 5xx
i need something like

number of successful requests * 100

(number of successful requests + number of failed requests)

how can i achieve that. In this case i have only one measurment

To get started you can run a count on a field.

SELECT count(“resp_bytes”)

This will allow you to see how many of a status code there are.You can do filtering.

Also consider using something like an aggregator so that you aren’t story the entire access log in InfluxDB if you only need counts
Aggregator ValueCounter