Splunk Search

How to construct a search that combines two different searches with no common fields?

pavanae
Builder

I'd joined two different searches and trying to display the search 2 table for search 1 users. Both the searches have the usernames field different

search 1 displays usernames with field name "usernumber"
search 2 displays usernames with field name "userid"

I know if both the searches has same field name i can display as below

search 1 | fields userid | join userid [search 2]

But here the scenario is different. Even though the field names are different, how can i combine those two searches?

0 Karma
1 Solution

sundareshr
Legend

Try this

(base search for search 1) OR (base search for search 2) | eval user=coalesce(usernumber, userid) | stats values(*) as * by user

*OR* if you must user join (not recommeded), just rename the field in the sub-search

search 1 | fields userid | join userid [search | fields | usernumber | rename usernumber AS userid] | ...

View solution in original post

0 Karma

sundareshr
Legend

Try this

(base search for search 1) OR (base search for search 2) | eval user=coalesce(usernumber, userid) | stats values(*) as * by user

*OR* if you must user join (not recommeded), just rename the field in the sub-search

search 1 | fields userid | join userid [search | fields | usernumber | rename usernumber AS userid] | ...
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...