Splunk Search

文字列を抽出して、テーブルにそれぞれ入れたい。

changhyunkim
New Member

以下のログ例)からフィールドを抽出して、テーブル①、テーブル②に分けたいのですが、
そのためのサーチ文をご教示いただけますでしょうか。

-----ログ例)-------
hostname:hogehoge
group:[
{
groupname:GroupA
}
{
groupname:GroupB
}

]

↓↓以下のようにテーブル化したい。

■テーブル①
groupname hostname


GroupA hogehoge

■テーブル②
groupname hostname


GroupB hogehoge

Tags (1)
0 Karma

tuemura_splunk
Splunk Employee
Splunk Employee

「テーブルを分ける」というご要望の理解ができていませんが、以下のようなサーチ例は要件にマッチしますでしょうか。
3行目まではサンプルデータ作成用ですので、4行目以降をご参考にしてください。

|  makeresults 
|  eval _raw="hostname:hogehoge#group:[#{#groupname:GroupA#}#{#groupname:GroupB#}#]"
|  rex field=_raw mode=sed "s/#/\n/g"
|  rex field=_raw "hostname:(?<hostname>.*)"
|  rex field=_raw max_match=0 "groupname:(?<groupname>.*)"
|  table groupname hostname 
|  mvexpand groupname
0 Karma

changhyunkim
New Member

上記、テーブルの表現が可笑しくなっていたので、
修正します。表現したいテーブル①と②は以下です。
■テーブル①
groupname hostname
+--------------- +--------------
GroupA hogehoge

■テーブル②
groupname hostname
+--------------- +--------------
GroupB hogehoge

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...