【问题标题】:Table, print number of rows per selected field表格,打印每个选定字段的行数
【发布时间】:2021-10-28 06:39:32
【问题描述】:

我正在执行如下 Splunk 查询:

myusername response_status="401" | 
  table website website_url user_name transaction_name user | 
    dedup website transaction_name

我得到带有 websitetransaction_name 过滤的唯一行的输出

如何获取每个 website 的行数或行数?

【问题讨论】:

    标签: splunk splunk-query


    【解决方案1】:

    计数是stats 命令的工作。

    myusername response_status="401" 
    | dedup website transaction_name
    | table website website_url user_name transaction_name user 
    | stats count by website
    

    【讨论】:

      【解决方案2】:

      | stats count 将成为你的朋友 - 而且它也会比尝试使用 dedup 更快:

      myusername response_status="401" 
      | stats count by website website_url user_name transaction_name user
      | fields - count
      

      如果您只想在该列表中中列出网站数量,请添加以下内容:

      | stats count by website
      

      【讨论】:

        猜你喜欢
        • 2014-10-19
        • 1970-01-01
        • 2016-10-16
        • 2013-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-05
        相关资源
        最近更新 更多