Splunk Dev

how to combine results after delimiting them ?

kumudjain
New Member

My logs contain application field which either have single value or multiple values.
I am using makemv command to delimit based on comma to separate applications when they are in multiple values as an array
but if an application for example [AML_PK2] is single in one log and is with many other applications in another log such as [AML_PK1, AML_PK2, AML_PK3] after counting for both results are like
AML_PK1 = 1
AML_PK2=1
AML_PK2 = 1
AML_PK3=1
How to combine results for aml_pk2 to show 2 counts?
My search query = index="app_web" |eval field1 = split(applications,"[") | eval field2 = split(field1,"]") | makemv delim="," field2 |search field2!=application/|search field2!=text/ |
top field2 by user countfield="No of Searches" showperc=False|rename field2 as "APPS"

Tags (1)
0 Karma
1 Solution

bangalorep
Communicator

This is what I tried.
| makeresults | eval a = "AML_PK1, AML_PK2, AML_PK3;AML_PK2" | makemv delim=";" a | mvexpand a | makemv delim=", " a | mvexpand a | stats count by a

View solution in original post

0 Karma

vnravikumar
Champion

Hi @kumudjain

Please try like

yoursearchhere |
 eval output = field1 + ";" + field2 |
 makemv delim=";" output |
 mvexpand output | stats count by output
0 Karma

kumudjain
New Member

Thanks a lot for your valuable feedback 🙂

0 Karma

bangalorep
Communicator

This is what I tried.
| makeresults | eval a = "AML_PK1, AML_PK2, AML_PK3;AML_PK2" | makemv delim=";" a | mvexpand a | makemv delim=", " a | mvexpand a | stats count by a

0 Karma

kumudjain
New Member

Thanks it was exactly what i was looking for! 🙂

0 Karma

bangalorep
Communicator

Oh great! Please accept the answer if it helped you 🙂

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...