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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...