Splunk Search

How to reorder _raw then dedup on _raw of the form?

arturodelvalle
New Member

Hi everyone

I am performing a dedup on raw of the form:

index=cisco_ucs host=KSCUCS2 splunk_server="spn2stl*" dn="sys/chassis-2/blade-8/bios/fw-boot-loader"    
|dedup _raw 

However Splunk returns 2-events which I believe should be only one as they are equivalent:

Event1:
    type="blade-bios",deployment="bootloader",dn="sys/chassis-2/blade-8/bios/fw-boot-loader",version="B200M3.2.2.4a.0.041720151158",packageVersion="2.2(5c)B",site="",system_name="KSCUCS2",address="10.150.222.13" 

Event2:
dn="sys/chassis-2/blade-8/bios/fw-boot-loader",deployment="bootloader",packageVersion="2.2(5c)B", 
version="B200M3.2.2.4a.0.041720151158",type="blade-bios",site="",system_name="KSCUCS2",address="10.150.222.13" 

Both events have the exact same fields and field-values with the exception that they are not in the same order and Splunk assumes they are different strings.

I have tried several commands such as makemv, sort, etc with no luck.
I tried the following which I cannot understand why it does not work:

index=cisco_ucs host=KSCUCS2 splunk_server="spn2stl*" dn="sys/chassis-2/blade-8/bios/fw-boot-loader"    
|eval raw2=_raw
|makemv raw2 delim=","
|eval s=mvsort(raw2)
|rename raw2 as _raw
|dedup _raw    

Thank you for your help

Tags (4)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

I think dedup won't work with multi-value fields. Try this.

index=cisco_ucs host=KSCUCS2 splunk_server="spn2stl*" dn="sys/chassis-2/blade-8/bios/fw-boot-loader"    
|eval raw2=_raw
|makemv raw2 delim=","
|eval s=mvsort(raw2)
|nomv s
|dedup s   
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I think dedup won't work with multi-value fields. Try this.

index=cisco_ucs host=KSCUCS2 splunk_server="spn2stl*" dn="sys/chassis-2/blade-8/bios/fw-boot-loader"    
|eval raw2=_raw
|makemv raw2 delim=","
|eval s=mvsort(raw2)
|nomv s
|dedup s   
---
If this reply helps you, Karma would be appreciated.
0 Karma

arturodelvalle
New Member

Thank you for the nomv command as this solved the problem, additionally my events had random whitespaces in different places which I solved using trim(_raw) before splitting the features, something to consider for other people that face this problem that took me about 2 days to solve

0 Karma

elliotproebstel
Champion

Shouldn't line 5 in your last snippet be |rename s as _raw?

0 Karma

arturodelvalle
New Member

That's right, thanks for catching that one. I miss typed on my question

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...