1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Splunkで直近の繰り上げ時間を作る

Posted at

小ネタ
Slackで投稿したので忘れないうちに

move_up_time.spl
index=_internal | head 100
| stats min(_time) as start max(_time) as end
| appendpipe [ eval time=relative_time(end,"+1h@h")]
| eval _time=coalesce(time,start)
| makecontinuous _time span=1h
start end _time count time
2020/07/23 20:00:00.000
1595503130.524 1595503142.065 2020/07/23 20:18:50.523 1
1595503130.524 1595503142.065 2020/07/23 21:00:00.000 2 1595505600.000000

binmakecontinuousは直近の時間は作ってくれる。この場合はcountnullのところ。
だけど、繰り上がった時間は作ってくれない。

addinfoが使えるかなと思ったけど、検索期間が全時間だとinfo_min_time0info_max_time+infinityだった:sweat:

appendpipeは直前の結果から、引き続きクエリーを追加できるので、この場合は使い勝手がよかった。

ステータスの変化をtimechartするときなどは使うかもしれません。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?