Splunk Search

How to remove words and characters from a multivalued filed

MeMilo09
Path Finder

Hello All, 

How can I remove words and characters from a multivalued field without using REX?

I have a filed named OS

OS:
Windows-2016
Windows-2010


How can I take out everything that comes in before the hyphen and just end up with the below?

OS:
2016
2010


Labels (2)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try mvmap and replace.

| makeresults 
| eval OS="Windows-2016
Windows-2010" 
| eval OS=mvmap(OS,replace(OS,"Windows-",""))

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

@richgalloway Your example doesn't create a mv-field but your solution works when the field is mv.

| makeresults 
| eval OS=split("Windows-2016
Windows-2010" ,"
")
| eval OS=mvmap(OS,replace(OS,"Windows-",""))

 

MeMilo09
Path Finder

Pretty close, just used mvindex instead. Thanks 

| eval OS_Name=split(OSName,"-"), Env=mvindex(OS_Name, 1)

0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

  Ready to master Kubernetes and cloud monitoring like the pros?Join Splunk’s Growth Engineering team for an ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...