Splunk Search

Correlate multivalues and count each relation to other values

Lithyum
Engager

Hi.

I need help in understanding how this can be done:

The application's log have a multivalue like this:

<somedata> [field1=A,B,C] <someotherdata>
<somedata> [field1=A,C] <someotherdata>
<somedata> [field1=E,F] <someotherdata>

And I need to find correlations between these values.

I'm looking to have something like:

field1mv  inConjunctionWith  count
A <all> 2
 A C 2
 A B 1
  B <all> 1
B A 1
C <all> 2
C A 2
C B 1
 E <all> 1
E F 1
F <all> 1
F E 1

 

This way it'll be possible to identify that A+C, and E+F, have the same occurrences and probably are always together; also it'll show which values are the most common.

 

I feel I should be able to pull this off with mvmap but can't make my brain produce the actual process to it.

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval inConjunctionWith=field1
| mvexpand inConjunctionWith
| mvexpand field1
| stats count by field1 inConjunctionWith
| eval inConjunctionWith=if(inConjunctionWith=field1,"<all>",inConjunctionWith)
| sort 0 field1 -count inConjunctionWith

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval inConjunctionWith=field1
| mvexpand inConjunctionWith
| mvexpand field1
| stats count by field1 inConjunctionWith
| eval inConjunctionWith=if(inConjunctionWith=field1,"<all>",inConjunctionWith)
| sort 0 field1 -count inConjunctionWith

Lithyum
Engager

Thanks ITWhisperer.

The mvexpand was the kicker! 😀

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...