有没有办法在计数层内按字典顺序对 top 命令的输出进行排序

Is there a way to sort the output of the top command lexicographically within the count strata

我正在编写一个 Splunk 查询来检索具有特定标识符令牌的错误代码,然后使用 top 命令按出现次数对它们进行排序。但是现在,我正在尝试将 top 命令的输出按字典顺序排列。

我已尝试阅读 Splunk 的 SPL 的一些文档,但找不到允许我执行此操作的命令或选项。

message=SplunkLogging::* | top limit=0 userQuery

例如,如果您有以下计数:A - 2、B - 5、C - 1、D - 2,我希望结果按这样排序:B - 5、A - 2、D - 2, C - 1.

通常的做法是创建一个包含要排序的值的临时字段。像这样:

message=SplunkLogging::* 
| top limit=0 userQuery 
| rex field=userQuery "- (?<sorter>\d+)" 
| sort - sorter 
| fields - sorter