Deployment Architecture

How do you display two sources from one Index with different fields?

egt
New Member

I want to display from two sources from one Index with different fields via a key value in the result fields from both sources. is that possible?

Example:
source 1 contains the following fields: Id, function, serial number,...

source2 contains these fields: Id, leasing_end, leasing_start;....

The ID field contains the key value.

The result should show which devices on a certain date have leasing end divided by function

Translated with www.DeepL.com/Translator

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@egt,

Another way is to use stats

index="your index" (source="source1" OR source="source2") |fields id,function,serial_number, leasing_end, leasing_start
|stats values(*) as * by id

Now you should be able to do further processing/checks on the data.
e.g.

Events(dummy)

|makeresults count=6|streamstats count as row|eval id=if(row<4,row,row-3)
|eval function=if(row<4,"func".id,"")|eval serialno=if(row<4,"sn".id,"")
|eval leasing_start=if(row>3,id."-11-2018",""),leasing_end=if(row>3,id."-12-2018","")
|fields _time,id,function,serialno,leasing_start,leasing_end

Final result

|makeresults count=6|streamstats count as row|eval id=if(row<4,row,row-3)
|eval function=if(row<4,"func".id,"")|eval serialno=if(row<4,"sn".id,"")
|eval leasing_start=if(row>3,id."-11-2018",""),leasing_end=if(row>3,id."-12-2018","")
|fields _time,id,function,serialno,leasing_start,leasing_end
|stats values(*) as * by id
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

@egt,

Another way is to use stats

index="your index" (source="source1" OR source="source2") |fields id,function,serial_number, leasing_end, leasing_start
|stats values(*) as * by id

Now you should be able to do further processing/checks on the data.
e.g.

Events(dummy)

|makeresults count=6|streamstats count as row|eval id=if(row<4,row,row-3)
|eval function=if(row<4,"func".id,"")|eval serialno=if(row<4,"sn".id,"")
|eval leasing_start=if(row>3,id."-11-2018",""),leasing_end=if(row>3,id."-12-2018","")
|fields _time,id,function,serialno,leasing_start,leasing_end

Final result

|makeresults count=6|streamstats count as row|eval id=if(row<4,row,row-3)
|eval function=if(row<4,"func".id,"")|eval serialno=if(row<4,"sn".id,"")
|eval leasing_start=if(row>3,id."-11-2018",""),leasing_end=if(row>3,id."-12-2018","")
|fields _time,id,function,serialno,leasing_start,leasing_end
|stats values(*) as * by id
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

kmaron
Motivator
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!

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 ...