Splunk Enterprise

Multivalue fields extraction

rukshar
Explorer

Hi,

Please help me in extracting multivalue fields from email body logs:

LOG:

"Computer Name","Patch List Name","Compliance Status","Patch List Name1","Compliance Status1","OS Type1" "XXXX.emea.intra","ACN - Windows Server - PL - Up to Oct24","Compliant","[ACN - Windows Server - PL - Up to Aug24] + [ACN - Windows Server - PL - Sep24]","Compliant","Windows" "XXXX.na.intra","ACN - Windows Server - PL - Up to Oct24","Compliant","[ACN - Windows Server - PL - Up to Aug24] + [ACN - Windows Server - PL - Sep24]","Compliant","Windows"

Fields i want to extract are these: "Computer Name","Patch List Name","Compliance Status","Patch List Name1","Compliance Status1","OS Type1"

I have applied rex to bring out all the fields 

The rex is giving me total number of 3131 computer_names but when i am using mvexpand command to expand in into multiple rows , it is giving me only 1500 results not sure why rest are getting truncated.

Attaching the search query and snippet for reference:

index=mail "*tanium*"
|spath=body
|rex field=body max_match=0 "\"(?<Computer_name>.*)\",\"ACN"
|rex field=body max_match=0 "\"(?<Computer_name1>.*)\",\"\[n"
|rex field=Computer_name1 max_match=0 "(?<Computer_name2>.*)\",\"\[n"
|eval Computer_name=mvappend(Computer_name,Computer_name2)|table Computer_name
|dedup Computer_name
| mvexpand Computer_name
| makemv Computer_name delim=","

rukshar_0-1730480716624.png

index=mail "*tanium*"
|spath=body
|rex field=body max_match=0 "\"(?<Computer_name>.*)\",\"ACN"
|rex field=body max_match=0 "\"(?<Computer_name1>.*)\",\"\[n"
|rex field=Computer_name1 max_match=0 "(?<Computer_name2>.*)\",\"\[n"
|eval Computer_name=mvappend(Computer_name,Computer_name2)
|rex field=body max_match=0 "\,(?<Patch_List_Name1>.*)\"\["
|rex field=Patch_List_Name1 max_match=0 "\"(?<Patch_List_Name>.*)\",\""
|rex field=Patch_List_Name1 max_match=0 "\",\""(?<Compliance_status>.*)\"
|table Computer_name Patch_List_Name Compliance_status
|dedup Computer_name Patch_List_Name Compliance_status
| eval tagged=mvzip(Computer_name,Patch_List_Name)
| eval tagged=mvzip(tagged,Compliance_status)
| mvexpand tagged
| makemv tagged delim=","
| eval Computer_name=mvindex(tagged,0)
| eval Patch_List_Name=mvindex(tagged,1)
|eval Compliance_status=mvindex(tagged,-1)
|table Computer_name Patch_List_Name Compliance_status

rukshar_1-1730480778199.png

 

 

 

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

1. This is not your whole event since you're doing spath to get it.

2. Don't search for "*tanium*". Wildcards at the beginning of search term will make Splunk read all raw events.

3. We don't know your data. How can we know why your results are "wrong"? Maybe some of your extractions don't work and you get nulls. Dedups or mvzips on them will yield null results.

4. There are two typical ways of debugging SPL searches. One is to start from the start and add commands until their results stop making sense. Another is to start from the end and remove commands untill the results start making sense.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...