0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SPL 超入門:これだけ覚えれば検索できるコマンド5選

0
Posted at

はじめに

Splunk を触り始めたとき、まず最初にぶつかるのが SPL(Search Processing Language)。
文法が独特で「むずかしそう…」と感じる人が多いですが、実は最初に5つのコマンドだけ覚えれば、ほとんどの基本検索はできます。

この記事では、初心者が最短で SPL を理解できるように、最低限必要なコマンドを厳選して解説します。

SPL の基本構造

SPL は「検索 → パイプで加工」の流れだけでできています。

検索条件 | 処理 | 処理 | ...

例えば:

index=web status=500 | stats count by host

意味:

  • 左側 → ログを探す

  • 右側 → 件数をまとめる

このパイプ( | )が SPL のキモです。「検索結果を次の処理に渡す」という意味です。

これだけ覚えれば検索できるコマンド5選

1. stats

SPL の中で最も重要。
件数、平均、最大・最小、割合などの集計がすべてできる万能コマンドです。
よく使う例 :
件数を数える

| stats count

2. timechart ― 時系列の集計

折れ線グラフや時系列データ向けのコマンド。

時間ごとに集計

| timechart count

3. top ― 出現回数ランキング

頻出項目を上位順に確認できます。

デフォルト上位10件

| top host

4. eval ― 計算・フィールド作成

数値変換

| eval rt_ms = response_time * 1000

5. where ― 絞り込み

検索後の結果から絞り込みたいときに使用。

| where response_time > 1000

まとめ

Splunk の基本検索は、実は以下の5つさえ覚えれば十分です。

コマンド できること
stats 集計(件数・平均)
timechart 時系列集計
top ランキング
eval 計算・加工
where 絞り込み
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?