【问题标题】:How to display table of top 5 URL with their status and percentage on splunk如何在 splunk 上显示前 5 个 URL 的表格及其状态和百分比
【发布时间】:2021-06-04 02:34:56
【问题描述】:

需要一个表格来显示以下 Splunk 中给出的前 5 个 URL。这在 Splunk 中可行吗?我尝试了很多方法,但我无法将 URL 的所有状态作为一行来获取。

API                         200        204  400 401 499 500

/wodetails/ACP              895(50%)    -    -   -   -   1

【问题讨论】:

    标签: splunk splunk-query splunk-formula


    【解决方案1】:

    这是可以使用chart命令的情况:

    index="main"  source="access.log" sourcetype="access_combined"
    | chart c(status) by uri, status
    
    uri 200 204 400 499
    /basic/status 11 1 1 1
    /search/results 3 0 0 0

    要添加百分比,您可以使用eventstats

    index="main"  source="access.log" sourcetype="access_combined"
    
    | eventstats count as "totalCount" by uri
    | eventstats count as "codecount" by uri, status
    | eval percent=round((codecount/totalCount)*100)
    
    | eval cell=codecount." (".percent."%)"
    
    | chart values(cell) by uri,status
    
    uri 200 204 400 499
    /basic/status 11 (79%) 1 (7%) 1 (7%) 1 (7%)
    /search/results 3 (100%)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      • 2013-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多