Histogram of response codes from apache log

Is it possible to write a query in flux to get a histogram of response codes from apache log?

My data format:
%{CLIENT:client_ip} [%{HTTPDATE:ts:ts-httpd}] “%{DATA:request}” %{NUMBER:resp_code:int} %{NUMBER:resp_bytes:int} %{NUMBER:resp_time:int}

I saw topic Telegraf: count field values (processing http response codes), but I am wondering about a solution on the query level.

in other words how to translate SELECT resp_code, Count(*) FROM systemdb GROUP BY resp_code to FLUX?

hey, try

from(bucket: "test") 
  |> filter(fn: (r) => r._measurement == "systemdb")
  |> group(columns: ["resp_code"])
  |> count()
  |> group()

resp_code will be in the output because it is part of the group key during the count. Then we ungroup to get one big set of rows instead of a 1-row count per group.