Splunk Search

How to rewrite the id with a type value of 2 to the id value with a type value of 1 for data with the same axid value?

tehong
Explorer

Hi experts,

Could you please advise me about SPL?

Given the data below, I would like to rewrite the id with a type value of 2 to the id value with a type value of 1 for data with the same axid value.

----------------------
axid, id, type
----------------------
0001,abc,1
0001,def,2
0001,ghi,2
0002,jkl,1
0002,mno,2
0002,pqr,2

Expected results follow

----------------------
axid, id, type
----------------------
0001,abc,1
0001,abc,2
0001,abc,2
0002,jkl,1
0002,jkl,2
0002,jkl,2

Thanks in adance!!

Labels (1)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval type1id=if(type=1,id,null())
| eventstats values(type1id) as id by axid

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval type1id=if(type=1,id,null())
| eventstats values(type1id) as id by axid

tehong
Explorer

Perfect Thanks Whisperer!

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...