Knowledge Management

How to extract the values from array?

mcohen13
Loves-to-Learn

I have a field that his elements looks the following:

["bedep","banjori","gameover","dyre","suppobox","necurs","unknown","conficker","kraken","emotet","mirai","virut","ccleaner"]

How can I only extract the names of the threats with "" from the array on a different field?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

By using split:

| makeresults 
 | eval name="[\"bedep\",\"banjori\",\"gameover\",\"dyre\",\"suppobox\",\"necurs\",\"unknown\",\"conficker\",\"kraken\",\"emotet\",\"mirai\",\"virut\",\"ccleaner\"]"
 | eval new_name = name
 | rex field=new_name mode=sed "s/\[|\]|\"//g"
 | eval new_name = split(new_name,",")
0 Karma

woodcock
Esteemed Legend

Like this:

| makeresults 
| eval name="[\"bedep\",\"banjori\",\"gameover\",\"dyre\",\"suppobox\",\"necurs\",\"unknown\",\"conficker\",\"kraken\",\"emotet\",\"mirai\",\"virut\",\"ccleaner\"]"
| eval new_name = name
| rex field=new_name mode=sed "s/[\[\]]//g"
| makemv delim="," new_name
| rex field=new_name mode=sed "s/\"//g"
0 Karma

vnravikumar
Champion

Hi

Try this

| makeresults 
| eval name="[\"bedep\",\"banjori\",\"gameover\",\"dyre\",\"suppobox\",\"necurs\",\"unknown\",\"conficker\",\"kraken\",\"emotet\",\"mirai\",\"virut\",\"ccleaner\"]" 
| eval result = replace(name, "\[|\]|\"","") 
| makemv delim="," result
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...