Splunk Search

how to avoid to use join

RiccardoV
Communicator

Hi,
I'm using Splunk 6.1 and I have two sourcetype for my data:
the first contains a list of events of this type

id category

the second contains events from a forwarder, and they have those fields:

id field1 field2 etc

I have to join those sourcetype, I want to draw some graphs counting how much id on the second sourcetype belong to the various categories.

Right now I have this query:

sourcetype="source2"
| table Id
| join type=inner Id [search sourcetype="source1" | table Id, category]
| table Id, category

How can I avoid to use join to improve performance?
Please note that source1 contains 12 millions of row, and it is updated daily (more or less), on the contrary source1 is updated constantly.

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

One suggestion for query using join itself for faster result.(assuming you want to plot count of ids from source2 based on category from source1)

sourcetype="source2" | stats count by Id | join Id [search sourcetype="source1" | table Id, category] |...other calculations...

Option without join

sourcetype="source2" OR sourcetype="source1" | table Id , category| stats count(eval(isnull(category))) as count values(category) as category by Id

View solution in original post

somesoni2
Revered Legend

One suggestion for query using join itself for faster result.(assuming you want to plot count of ids from source2 based on category from source1)

sourcetype="source2" | stats count by Id | join Id [search sourcetype="source1" | table Id, category] |...other calculations...

Option without join

sourcetype="source2" OR sourcetype="source1" | table Id , category| stats count(eval(isnull(category))) as count values(category) as category by Id
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...