Getting Data In

異なるsourcetypeから同じ名前のfieldをかけあわせる方法について

appleman
Contributor

異なるソースタイプ[sourcteype=A][sourcetype=B]の中に、それぞれ[field=zzz]という同じ名前のフィールドがあります。
これをサーチで1つにかけあわせて検索する方法で[join]というものを使って下記の通りに検索したところ、"No result"となりました。もし何か、異なるソースタイプで共通するフィールドを一つにまとめて検索する方法がございましたら、ご教授下さい。

sourcetype=A host=* | table xxx yyy | join zzz [ search sourcetype=B | table zzz ] | table xxx yyy zzz

0 Karma
1 Solution

melonman
Motivator

joinでもいいですが、statsでまとめてしまうとわかりやすいです。

例)field1がsourcetype=Aに存在するfield、field2がsourcetpe=Bに存在するfield, zzzが両方のsourcetypeに存在するfieldとすると、

sourcetype=A OR sourcetype=B | stats list(field1) as field1 list(field2) as field2 by zzz

これで、共通のzzzに対して、それぞれのsoucetypeが持っているfield(field1,field2 ...)をグルーピングすることができます。その後に、必要な集計を行うようにするという方法ではどうでしょうか。

View solution in original post

melonman
Motivator

joinでもいいですが、statsでまとめてしまうとわかりやすいです。

例)field1がsourcetype=Aに存在するfield、field2がsourcetpe=Bに存在するfield, zzzが両方のsourcetypeに存在するfieldとすると、

sourcetype=A OR sourcetype=B | stats list(field1) as field1 list(field2) as field2 by zzz

これで、共通のzzzに対して、それぞれのsoucetypeが持っているfield(field1,field2 ...)をグルーピングすることができます。その後に、必要な集計を行うようにするという方法ではどうでしょうか。

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...