The `stats` command calculates statistics based on fields in your events. It can count, average, sum, and find distinct values.
You structure it like: `| stats count by field_name` to get the number of events per unique value of that field.
index=main "error" | stats count by host