Getting Data In

Find unique values on all search rows separated by comma

habrhi
Explorer

Hi all,

I need to count the unique values of each row i have in my search (maybe this sounds abstract to you), the data i have in my cells are separated by "," .
Here is an example:

ID               |             A                 |                B
1                 |        a,b,c                |                3                   ("a","b","c" are unique here)
2                 |            a,d               |               1                   ("a" has been already found, so the only unique value is "d")
3                  |          b,k,e            |               2                   ("b" has been already found, only unique values are "k" and "e")

I tried to run dedup and rex field , but cannot get the search right. could anyone help?
One more question , is it possible to duplicate the row but only in each line i find only one value (example):

ID               |             A                       |                A_mod
1               |             a,b,c                |                  a
1               |             a,b,c                |                  b
1               |             a,b,c                |                  c
----------------------------------------
2               |             a,d                    |                  a
2               |             a,d                    |                  d
-----------------------------------------
3               |             b,k,e                 |                  b
3               |             b,k,e                 |                  k
3               |             b,k,e                 |                  e

Sorry if i posted two questions, i am just asking about the possibility and how to achieve it.
I thought of this exemple because it might get easier by then to run dedup

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Second part is reasonably simple

| eval A_mod=split(A,",")
| mvexpand A_mod

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

 

| eval A_mod=split(A,",")
| mvexpand A_mod
| dedup A_mod
| stats values(A) as A, count as B by id

 

Full solution

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Second part is reasonably simple

| eval A_mod=split(A,",")
| mvexpand A_mod
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...