5
4

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中級者向けjoin系コマンドの罠

Last updated at Posted at 2020-11-12

はじめに

  • SplunkのSPLコマンドに慣れてきた方へ
  • 気づかずにSPLの制限にはまっていて、実はサーチ結果が不十分な結果になっていた。。
    • なんてことにならないために、よくあるSPL制限をまとめていきたいと思います。
  • まずはSplunk中級者?がハマりがちなsubsearchs、join、append、inputlookupの制限をチェック
    • Splunk Version 8.1.0をベースに記載

subsearches (join, append, inputlookupの組み合わせ利用)

  • デフォルトのイベント件数の制限
    • サブサーチの結果は10,000件まで!
    • サブサーチ結果をjoinコマンドで繋げる場合は上限が50,000件に変わります!
    • サブサーチ結果をappendコマンドで繋げる場合は上限が50,000件に変わります!
  • 詳細説明
やりがちなSPL例:実はasset.csvが10,000件しか読み込まれていない。。。
|join IpAddress [|inputlookup asset.csv |rename ip as IpAddress]

置き換えSPL例(lookupコマンドで代用する)
|lookup asset.csv ip as IpAddress
  • lookupコマンドの場合、イベント件数制限ではなくlookupファイルをメモリに展開するサイズ制限になります。カラムの数にも依存しますが、inputlookupの件数制限よりも多くマッチングできることが多いのでオススメ

inputlookup

  • デフォルトは最大イベント件数が1,000,000,000件
    • しかし、subsearchと組み合わせると最大イベンド件数が変わるので注意。subsearchにて説明
SPL例
|inputlookup asset.csv 

append

  • デフォルトは最大イベント件数が50,000件
SPL例
|append [|search index=main sourcetype="xxx" status=Unassociated] 

join

  • デフォルトは最大イベント件数が50,000件
SPL例
| join product_id [search vendors | rename pid AS product_id]

stats

  • 集計の祖、statsコマンドにもやはり上限値はあります。

stats list(xxx)

limits.conf.specより抜粋
list_maxsize = <integer>
* Maximum number of list items to emit when using the list() function
  stats/sistats
* Default: 100
5
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?