如果您可以發佈您的示例數據&或您的示例搜索,它更容易弄清楚。我只會發布一些我認爲可能會讓你朝着正確方向發展的例子。
假設'/ search/results'在一個名爲「uri_path」的字段中。
earliest=-2w latest=-1w sourcetype=app_logs uri_path='/search/results'
| stats count(uri_path) by date_hour
會給你一個小時的數量(總和)在過去一週,每小時。
earliest=-2w latest=-1w sourcetype=app_logs uri_path=*
| stats count by uri_path, hour
將不同的uri_paths拆分表(可以認爲'group by')。
如果您不想使用時間範圍縮寫(w = week,mon = month,則可以使用搜索欄右側的時間範圍選擇器來使用GUI來選擇時間) m =分鐘等等)。
之後,所有你需要做的是|
pipe到stats命令,你可以通過date_hour(這是一個自動生成的字段)進行計數。
注: 如果沒有uri_path領域已經提取出來,你可以用rex
命令做到這一點真的很容易。
... | rex "matching stuff before uri path (?<uri_path>\/\w+\/\w+) stuff after'
| uri_path='/search/results'
| stats count(uri_path) by date_hour
如果您想了解更多:
- Stats Functions (in Splunk)
- Field Extractor - 永久提取