Grouping or Limting by Specific fields

If you have events want to select or group by and then limit the number of matching events or values (for example the top or bottom 5 rows), there are a few options available:

Use tokenHash()

The tokenHash() function creates a hash of the string, or more specifically the basic form of the string. You can either do this the entire event:

logscale
hash := tokenHash(@rawstring)
| groupBy(hash,function=tail(1))

This creates a hash based on the event value and outputs just entry for each matching hash; that event value could then be used to identify the list of events.

This solution has the advantage that you dont ned to identify the individual fields that you want to search/select by.

Compose a String from an Array

If you want to be more specific, create a create made up of identifying values and then group by that value:

logscale
entryident := format("%s%s%s",field=[#kind,#repo,#type])
| groupby(entryident,function=[count()])

You can add a head() or tail() to limit the list.