Splunk Search

Mvexpand

SN1
Path Finder

Hello I have this search

| inputlookup defender_onboard.csv
| fillnull value=NA
| search Region="***" 4LetCode="*"
| search NOT [inputlookup ex_sou.csv| fields DeviceName]
| search NOT [inputlookup ex_defender.csv | fields DeviceName]
| table DeviceName Region DeviceType OSType OSVersion

now i am getting this result

SN1_0-1742281367774.png



i want region to be expanded to get individual row.



Labels (1)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @SN1 

Are you wanting to get rid of duplicates? e.g. so that only EMEA only appears once for bar-t1001.homag-group?

If so I think the following might help

| stats values(*) AS * by DeviceName

Please let me know how you get on and consider adding karma to this or any other answer if it has helped.
Regards

Will

0 Karma

kiran_panchavat
Champion

@SN1 

To expand the Region field into individual rows for each value, you can use the makemv command to convert the Region field into a multivalue field (if it's not already) and then use mvexpand to generate a row for each value.

makemv: Converts the Region field into a multivalue field using the comma as a delimiter.
mvexpand: Expands each multivalue Region into separate rows.
 
| makeresults count=5
| eval DeviceName = "mt_20736887n11.homag.com", Region = "NA,EMEA", DeviceType = "Workstation", OSType = "Windows10", OSVersion = "10.0"
| append [| makeresults count=1 | eval DeviceName = "par-t-1801.homag-group", Region = "EMEA", DeviceType = "Workstation", OSType = "Linux", OSVersion = "null"]
| append [| makeresults count=1 | eval DeviceName = "usbrelais.homag.com", Region = "NA", DeviceType = "Workstation", OSType = "Windows10", OSVersion = "10.0"]
| makemv delim="," Region
| mvexpand Region
| table DeviceName Region DeviceType OSType OSVersion

kiran_panchavat_0-1742281981504.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...