Splunk Search

How to join data and extract field values as field names?

splunk_worker
Path Finder

How to change event field values into field name?

Event log sample1:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
id, code, message
1, 1111, "one"
3, 12345, "three"

Event log sample2:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
id, keyname, keyvalue
1, name , john
1, place, richmond
1, activity, login
1, environment, mobile
2, name , bob
2, lastname, bill
3, name, charle
3, location, newyork
3, activity, transaction
4 name, Danny
4 lastname, Huber
5, name, eugene

Both event have common field called "id". I will join both data searches using join command.
e.g: index=abc code=111 | join id [search index=blah ]

But my requirement is, for the above search when the code is 111, i need get the table in following format
id, code, message, name, place, activity, environment
1 , 1111, "one", john, richmond, login, mobile

Please note that, the values of keyname and keyvalue are become field-name and its values respectively. Please let me know how to do this?

0 Karma

somesoni2
Revered Legend

Try this

index=abc code=1111 | join id [search index=blah | xyseries id keyname keyvalue]

OR

index=abc code=1111 | join id [search index=blah | chart first(keyvalue) over id by keyname]
0 Karma

strive
Influencer

Try this

 index=abc  code=1111 | join id[search index=blah | chart first(keyvalue) by id keyname]
0 Karma

strive
Influencer

In your question, you said you need it for code 1111. Take out the condition code=1111 and execute the search.

0 Karma

splunk_worker
Path Finder

Thanks for ur response.

The above searching is putting keyname parameter values as column variables (this 100% fine). But the value from keyvalue is displayed only for one column variable ( created from keyname) per id.

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