Splunk Search

Combine data from 2 indexes

hvdtol
Path Finder

Hi,

I am trying to combine data from 2 indexen, but i find it hard to do.
I tried several stats values command, but that  did not gave me the solution
This is my source:

collection        hostname        stage          stagedata
                                                        st1               A1234;DEF
                                                        st1               A3456;XYZ
                                                        st2                A7890;XYZ
                                                        st3                B1234;ABC
COLLA               h1                     st1
COLLA              h2                     st1
COLLB              h3                      st2
COLLB              h4                      st2
COLLC             h5                       st1
COLLD              h6                       st3


An this is what i am trying to accomplice:

collection hostname            stage     stagedata
COLLA       h1                           st1          A1234;DEF
                                                                      A3456;XYZ
COLLA       h2                           st1          A1234;DEF
                                                                      A3456;XYZ
COLLB      h3                           st2           A7890;XYZ
COLLB     h4                            st2           A7890;XYZ
COLLC    h5                             st1           A1234;DEF
                                                                       A3456;XYZ
COLLD     h6                           st3            B1234;ABC

Any help would be appreciated.

Regards,

Harry

Labels (1)
0 Karma
1 Solution

hvdtol
Path Finder

Aah, the trick is to combine fields....
Of course. Very smart.

Thank you very much.

Regards,

Harry

View solution in original post

0 Karma

hvdtol
Path Finder

Aah, the trick is to combine fields....
Of course. Very smart.

Thank you very much.

Regards,

Harry

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Please can you mark the solution as the solution rather than your response to the solution?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults 
| eval _raw="collection,hostname,stage,stagedata
,,st1,A1234;DEF
,,st1,A3456;XYZ
,,st2,A7890;XYZ
,,st3,B1234;ABC
COLLA,h1,st1
COLLA,h2,st1
COLLB,h3,st2
COLLB,h4,st2
COLLC,h5,st1
COLLD,h6,st3"
| multikv forceheader=1
| table collection hostname stage stagedata



| eval collectionhost=collection."!".hostname
| fields - collection hostname
| stats values(*) as * by stage
| stats values(*) as * by collectionhost stage
| eval collection=mvindex(split(collectionhost,"!"),0)
| eval hostname=mvindex(split(collectionhost,"!"),1)
| table collection hostname stage stagedata
0 Karma
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...