Splunk Search

How to index combination with different event structure?

aa0
Path Finder

Hi all,

I would like to create a table with details involved from two different index created. I'm facing difficulty in combining the data from both two indexes with common columns but different event structure. How to start a query to merge/combine fields from different indexes? As mentioned, both indexes consist of one similar field which is user=john. Here are the details:

 

IndexA

fieldA1=user (john)

fieldA2=description

 

IndexB

fieldB1=user (john)

fieldB2=Workstation

fieldB3=EventCode

 

Expected result:

user| EventCode| description| Workstation

john|      4740     |locked out| Lenovo..

 

could someone point me to the right direction on how to start a Splunk Cloud query to merge into one table?

Many thanks.

Labels (2)
0 Karma

aa0
Path Finder

thanks for your reply, unfortunately I'm actually looking for other query. I've tried this to start so far:

|set union[search index=indexA user=john|fields description user][search index=indexB user=john|fields user EventCode Workstation]

could someone help to expand the search idea or make few tweaks to merge into one table?

Many thanks.

0 Karma

johnhuang
Motivator

Assuming you're using indexA's user description to enrich events from indexB.

 

index IN ("indexA", "indexB") user=john
| eventstats max(description) AS description BY user
| search EventCode=*
| table _time user EventCode description Workstation

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @aa0,

you have to use teh sats command, something like this:

index=indexA OR index=indexB
| stats values(EventCode) AS EventCode values(description) AS description  values(Workstation) AS Workstation BY user

if you have more values, you can choose to display al the values (as in the above sample) or only the first or only the last (using first or last instead values).

Ciao.

Giuseppe

0 Karma
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...