0
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?

【初心者向け】 Splunk検索コマンド 【IN / NOT編】

0
Posted at

はじめに

Splunkを利用する中でよく使用される「IN / NOT」について整理しました。

検索条件をより柔軟に指定できるため、ログ調査の精度を上げるための基本として備忘録をまとめています。


INとは

INは、複数の値のいずれかに一致するデータを検索するために使用します。

index=main host IN (server01, server02, server03)

この検索は以下のいずれかのhostに一致するログを対象とします:

  • server01
  • server02
  • server03

ORとの違い

同じ意味はORでも書くことができます。

index=main host=server01 OR host=server02 OR host=server03

ただしINを使うことで、よりシンプルに記述できます。

NOTとは

NOTは、特定の条件を除外するために使用します。

index=main NOT error

この検索は「errorを含まないログ」を対象とします。

INとNOTの組み合わせ

INとNOTは組み合わせて使用することもできます。

index=main host IN (server01, server02) NOT failed

この検索は以下の条件になります:

  • server01 または server02 のログ
  • ただし failed を含むログは除外

まとめ

今回は Splunk の IN / NOT について整理しました。

INを使うことで複数条件を簡潔に記述でき、NOTを使うことで不要なログを除外できます。

AND / ORと組み合わせることで、より柔軟な検索が可能になります。

0
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
0
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?