<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to extract values from multivalue field and Count number of co-occurences of values in a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374801#M110158</link>
    <description>&lt;P&gt;Hey &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;, I'm facing some trouble with a step after this. I want the Connected_tier to not have the app/single_tier in which it is there. For example, (taking your example), if APP1 is the single_tier, then the connected_tier values should only be APP2, APP3, APP5. APP1 should not be included there, it should also not be counted when we do the &lt;CODE&gt; |stats count BY single_tier single_tiers &lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I'm pretty sure this is very straightforward, but I've looked at a lot of things and I have not been able to find an answer so far. &lt;/P&gt;

&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;! &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:48:47 GMT</pubDate>
    <dc:creator>EvaRex</dc:creator>
    <dc:date>2020-09-29T14:48:47Z</dc:date>
    <item>
      <title>How to extract values from multivalue field and Count number of co-occurences of values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374798#M110155</link>
      <description>&lt;P&gt;Hi! &lt;/P&gt;

&lt;P&gt;I'm really new to Splunk so please excuse the simplicity of my question.&lt;/P&gt;

&lt;P&gt;I have an inputlookup table (eg.csv) that looks like: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  APP | Connected_Apps
 APP1 | 1=APP1 2=APP2 3=APP3 
      | 1=APP2 2=APP1 3=APP5
    ...
 APP2 | 1=APP1 2=APP2 3=APP3 ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We get this inputlookup table by executing: &lt;BR /&gt;
 &lt;CODE&gt;&lt;BR /&gt;
 | inputlookup tiers.csv &lt;BR /&gt;
 | makemv tiers&lt;BR /&gt;
 | rex field=tiers "\d=(?[^ ]*)"&lt;BR /&gt;
 | nomv tiers&lt;BR /&gt;
 | stats values(tiers) AS tiers by single_tiers &lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Now, I want to break this down such that the output is: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Single_tier| Connected_tier | Connection_Strength
         APP1 | APP2 | 15
              | APP3 | 32 
        APP2 | APP1  |2
             | APP5   |94
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The Connection_Strength is how many times these 2 apps occur together in the same tier in the original inputlookuptable (tiers.csv). &lt;/P&gt;

&lt;P&gt;This is what I have so far: &lt;BR /&gt;
&lt;CODE&gt;| inputlookup eg.csv &lt;BR /&gt;
| eval app_tiers=split(tiers, "\d+=") &lt;BR /&gt;
| makemv app_tiers |mvexpand app_tiers| dedup app_tiers| mvcombine app_tiers| sort tiers&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The other thing I tried is: &lt;BR /&gt;
&lt;CODE&gt;|inputlookup eg.csv | eval app_tiers=split(tiers, "=") | makemv app_tiers | eval clean_app_tiers=mvfilter(match(app_tiers,"(?[a-zA-Z]+)")) &lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Please help, thank you! Appreciate it a lot!!!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:41:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374798#M110155</guid>
      <dc:creator>EvaRex</dc:creator>
      <dc:date>2020-09-29T14:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from multivalue field and Count number of co-occurences of values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374799#M110156</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval raw="APP1 | 1=APP1 2=APP2 3=APP3 
APP1 | 1=APP2 2=APP1 3=APP5
APP2 | 1=APP1 2=APP2 3=APP3"
| makemv delim="
" raw
| mvexpand raw
| rename raw AS _raw
| rex "^(?&amp;lt;APP&amp;gt;\S+)\s*\|\s*(?&amp;lt;Connected_Apps&amp;gt;.*)$"
| table APP Connected_Apps

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rename APP AS single_tier Connected_Apps AS tiers
| rex max_match=0 field=tiers "\d\=(?&amp;lt;single_tiers&amp;gt;[^ ]*)"
| stats count BY single_tier single_tiers
| stats list(single_tiers) AS Connected_tier list(count) AS Connection_Strength BY single_tier
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 21:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374799#M110156</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-29T21:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from multivalue field and Count number of co-occurences of values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374800#M110157</link>
      <description>&lt;P&gt;Thank you @woodcock!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 17:34:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374800#M110157</guid>
      <dc:creator>EvaRex</dc:creator>
      <dc:date>2017-07-05T17:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from multivalue field and Count number of co-occurences of values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374801#M110158</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;, I'm facing some trouble with a step after this. I want the Connected_tier to not have the app/single_tier in which it is there. For example, (taking your example), if APP1 is the single_tier, then the connected_tier values should only be APP2, APP3, APP5. APP1 should not be included there, it should also not be counted when we do the &lt;CODE&gt; |stats count BY single_tier single_tiers &lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I'm pretty sure this is very straightforward, but I've looked at a lot of things and I have not been able to find an answer so far. &lt;/P&gt;

&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;! &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:48:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374801#M110158</guid>
      <dc:creator>EvaRex</dc:creator>
      <dc:date>2020-09-29T14:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from multivalue field and Count number of co-occurences of values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374802#M110159</link>
      <description>&lt;P&gt;If I understand you correctly, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="APP1 | 1=APP1 2=APP2 3=APP3 
APP1 | 1=APP2 2=APP1 3=APP5
APP2 | 1=APP1 2=APP2 3=APP3" 
| makemv delim="
" raw 
| mvexpand raw 
| rename raw AS _raw 
| rex "^(?&amp;lt;APP&amp;gt;\S+)\s*\|\s*(?&amp;lt;Connected_Apps&amp;gt;.*)$" 
| table APP Connected_Apps

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rename APP AS single_tier Connected_Apps AS tiers 
| rex max_match=0 field=tiers "\d\=(?&amp;lt;single_tiers&amp;gt;[^ ]*)"
| eval single_tiers=mvjoin(single_tiers, "::") . "::" 
| eval single_tiers=replace(single_tiers, single_tier. "::", "") 
| makemv delim="::" single_tiers 
| stats count BY single_tier single_tiers 
| stats list(single_tiers) AS Connected_tier list(count) AS Connection_Strength BY single_tier
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jul 2017 20:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-multivalue-field-and-Count-number-of/m-p/374802#M110159</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-07T20:45:56Z</dc:date>
    </item>
  </channel>
</rss>

