【问题标题】:Count count in splunk在 splunk 中计数
【发布时间】:2021-10-06 08:11:36
【问题描述】:

您可以通过 time_span 在 Splunk 中进行双重计算吗? 我想统计一个小时内售出的水果的点击次数。

我的代码:

|bucket _time span=1h |eventstats 按水果计为 count_in_an_hour time |stats counts as count_count by fruit |table fruit count count_count |排序 count_count 个数

我可以用一点数据来运行它;但是因为我有大量的数据,所以它需要很长时间并且占用大量空间导致“空间不足错误”。

我的样本数据集,

name    fruit   location time

mary    apple   east 5.10

ben pear    east 6.10

peter   pear    east 5.50

ben apple   north 7.10

ben mango   north 7.40

peter   mango   north 5.30

mary    orange  north 7.20

alice   pear    north 7.20

janet   pear    north 7.20

janet   mango   west 6.30

janet   mango   west 5.50

peter   mango   west 4.20

janet   pear    west 5.50

【问题讨论】:

    标签: splunk splunk-query


    【解决方案1】:

    如果这是限制因素,您可以尝试让您的管理员增加磁盘空间限制。

    如果您的管理员启用了search_process_memory_usage_threshold 设置,则要求提高阈值。

    也许更好的选择是减少处理结果的数量。您可以通过以下几种方式做到这一点:

    1. 使用更小的时间窗口

    2. 尽早使用fields命令减少数据量 处理完毕

    3. 使基础搜索尽可能具体,以减少 数据处理

    例如:

    index=foo name=* fruit=* earliest=-24h
    | fields _time name fruit
    | bucket _time span=1h 
    | eventstats count as count_in_an_hour by fruit time 
    | stats count as count_count by fruit 
    | sort count_count count_in_an_hour 
    | table fruit count_in_an_hour count_count 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-08
      • 1970-01-01
      • 2018-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      相关资源
      最近更新 更多