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.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

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 in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...