Reporting

How to Filter out rows when multivalues are present

cindygibbs_08
Communicator

Hello everyone I hope you guys are doing just great!

 

I have a sort of simple question but I have not been able to come up with a solution.. I want to be able to filter out rows of a table where there are multivalues based a numeric criteria, this is an example:

I have this:

AGENTINXROCKSTASK
XX_9

7

9

-6

T

Y

U

TY-8

GY-0

FG-67

XX_10

7

-49

-66

UY

IO

UJI

TY-8E

G-0

VG-67

 

I would like to only remove all rows in the table where  the multivalue field "INX" have negative numbers and have something like this:

AGENTINXROCKSTASK
XX_9

7

9

T

Y

TY-8

GY-0

XX_10

7

UY

TY-8E

 

I have tried using mvfilter and mvfind and mvindex but... every trial has not been successful yet so I really love you guys for helping me out thanks a LOTTTT

kindly,

Cindy

Labels (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@cindygibbs_08 

Can you please try this?

YOUR_SEARCH
| eval t=mvzip(mvzip(INX,ROCKS),TASK)
| stats count by AGENT,t
| eval INX= mvindex(split(t,","),0), ROCKS=mvindex(split(t,","),1), TASK=mvindex(split(t,","),2)
| where INX > 0

| stats list(INX) as INX list(ROCKS) as ROCKS list(TASK) as TASK by AGENT

 

My Sample Search :

| makeresults | eval _raw="AGENT	INX	ROCKS	TASK
XX_9	7|9|-6	T|Y|U	TY-8|GY-0|FG-67
XX_10	7|-49|-66	UY|IO|UJI	TY-8E|G-0|VG-67
" | multikv forceheader=1 | eval INX=split(INX,"|"), ROCKS=split(ROCKS,"|"), TASK=split(TASK,"|")
| rename comment as "Upto Now is sample data only"
| eval t=mvzip(mvzip(INX,ROCKS),TASK)
| stats count by AGENT,t
| eval INX= mvindex(split(t,","),0), ROCKS=mvindex(split(t,","),1), TASK=mvindex(split(t,","),2)
| where INX > 0

| stats list(INX) as INX list(ROCKS) as ROCKS list(TASK) as TASK by AGENT

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@cindygibbs_08 
Glad to help you. You suppose to accept one of my answer.  🙂

 

kamlesh_vaghela
SplunkTrust
SplunkTrust

@cindygibbs_08 

Can you please try this?

YOUR_SEARCH
| eval t=mvzip(mvzip(INX,ROCKS),TASK)
| stats count by AGENT,t
| eval INX= mvindex(split(t,","),0), ROCKS=mvindex(split(t,","),1), TASK=mvindex(split(t,","),2)
| where INX > 0

| stats list(INX) as INX list(ROCKS) as ROCKS list(TASK) as TASK by AGENT

 

My Sample Search :

| makeresults | eval _raw="AGENT	INX	ROCKS	TASK
XX_9	7|9|-6	T|Y|U	TY-8|GY-0|FG-67
XX_10	7|-49|-66	UY|IO|UJI	TY-8E|G-0|VG-67
" | multikv forceheader=1 | eval INX=split(INX,"|"), ROCKS=split(ROCKS,"|"), TASK=split(TASK,"|")
| rename comment as "Upto Now is sample data only"
| eval t=mvzip(mvzip(INX,ROCKS),TASK)
| stats count by AGENT,t
| eval INX= mvindex(split(t,","),0), ROCKS=mvindex(split(t,","),1), TASK=mvindex(split(t,","),2)
| where INX > 0

| stats list(INX) as INX list(ROCKS) as ROCKS list(TASK) as TASK by AGENT

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

cindygibbs_08
Communicator

Hello @kamlesh_vaghela  thank you so much for your help, I have one final question... would this example still stand for multiple cases... not just this particular one but for all that are like this... moreover does the mvzip function truncate after a number of statistics?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@cindygibbs_08 

Yes, the sample example will work with similar use cases also. 

mvzip used for combining two multivalued fields and no truncation I have faced ever with mvzip. 🙂 

https://docs.splunk.com/Documentation/SCS/current/SearchReference/MultivalueEvalFunctions#mvzip.28.2...

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...