Splunk Search

特定の時間のstatus=successより一つ前のstatus=successをとる方法

appleman
Contributor

時間を指定して、その時間帯に出ているオペレーションに対するステータスが成功(status=success)に対し、その時間よりも前でstatus=successが出ているのを抽出しその間の時間を出したい時にどのようなサーチ文を組めばよろしいでしょうか。
durationを出すためにはtransactionを利用しますが、単純にindex=* | transaction stratswith=(status="success") endswith=(status="success")とやるとNo Resultが返ってきてしまいます。
この中にeval等で時間を指定していかなきゃいけないと思うのですが、その指定方法をご教示お願い致します。

0 Karma
1 Solution

bananaman
Path Finder

streamstats はいかがでしょうか?

類似のAnswers記事がありますが、このような前イベントとのフィールド値の比較でしょうか?

comparing-fields-with-previous-events

以下のようなイメージ?でしょうか。。。

sourcetype=xxxx status=success  | streamstats current=false window=1 last(_time) as previous_time | eval diffTime=_time-previous_time | table _time previous_time diffTime

View solution in original post

bananaman
Path Finder

streamstats はいかがでしょうか?

類似のAnswers記事がありますが、このような前イベントとのフィールド値の比較でしょうか?

comparing-fields-with-previous-events

以下のようなイメージ?でしょうか。。。

sourcetype=xxxx status=success  | streamstats current=false window=1 last(_time) as previous_time | eval diffTime=_time-previous_time | table _time previous_time diffTime

appleman
Contributor

ありがとうございます!

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...