5
3

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でサマリーインデックスを作る

Last updated at Posted at 2020-06-05

サマリーインデックスは、検索結果を別のインデックスとして保持してくれる。

デフォルトのソースタイプ_stash_を使うかぎりは、別途ライセンス料金は取られない。

コマンドはcollect

ただ、ログにaddinfoと同じ_info_min_time_等の結果がついてくるので、気になる人は気になるみたい。addinfoはリンク参照

#実験

props.conf
[summeries]
TRANSFORMS-info_del = info_del
transforms.conf
[info_del]
REGEX = (?m)([^,]+,).*\s*(count=\d+)
FORMAT = $1$2
DEST_KEY = _raw

を準備して、

making_summery_index.spl
| tstats count where index=_internal by _time span=12h
| collect sourcetype=summeries
result
_time	count
2020/06/04 21:00	344
2020/06/05 09:00	24292
2020/06/05 21:00	104435

をサマリーインデックス化

_timeをログに載っけたかったので、|collect addtime=trueのデフォルト設定を利用している。

#結果

index=summary
06/05/2020 21:00:00 +0900,count=104435
06/05/2020 09:00:00 +0900,count=24292

_timeのあとinfo_min_time= ,info_max_time= ,info_search_time= が続くので、 _transforms.conf_で_rawを消している。

#一般化

transforms.conf
[info_del]
REGEX = (?m)([^,]+,)[^,]+,[^,]+,[^,]+,\s*(.*)
FORMAT = $1$2
DEST_KEY = _raw

一般化するとこんな感じだと思う。

ただ、もちろん別途ライセンス計算に計上される

#まとめ
最初|collect addtime=の挙動を調べるため、やっていました。

[stash]のスタンザに設定すれば、ライセンスの話とかなんとかなりそうですが、$SPLUNK_HOME/bin/splunk cmd btool props list stash --debugの結果が沢山あって、自分ではetc/apps/{appname}/local/配下に設定しても上手く行きませんでした。

上手く行っている方がいたら、やり方を教えてください。

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?