<?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: Dedup field values using if(match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512881#M143871</link>
    <description>&lt;P&gt;Maybe you need a sum(count) rather than a list(count)?&amp;nbsp; I'm not sure what the overall goal is so sorry for the piece meal answers.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2020 20:18:16 GMT</pubDate>
    <dc:creator>mfasciano_splun</dc:creator>
    <dc:date>2020-08-06T20:18:16Z</dc:date>
    <item>
      <title>Dedup field values using if"match"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512835#M143849</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I am attempting to put together a search where I'm taking website status (200=allowed, etc) and breaking it into allowed and denied:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;| stats count by user, status, http_method
| eval action=if(match(status,"^(2)([0-9]*)$"),"Allowed","Denied")
| stats   list(action) as Action, list(count) as "Count", sum(count) as total by user http_method 
| eval "Creds Entered"=if(http_method="POST","Yes","No") 
| sort - total
| fields - total 
| table user Action Count "Creds Entered"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The issue I'm running into is the field for Action (allowed/denied) is not just populating allowed or denied, but multiples of each:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BB34_0-1596737597297.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10089i79B60B3E896A41BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BB34_0-1596737597297.png" alt="BB34_0-1596737597297.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So far I have reviewed the following with no success:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/MultivalueEvalFunctions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/MultivalueEvalFunctions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Multivaluefunctions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Multivaluefunctions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Mvcombine" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Mvcombine&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Makemv#Description" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Makemv#Description&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Nomv" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Nomv&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Mvexpand" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Dedup-within-a-MV-field/td-p/34957" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/Dedup-within-a-MV-field/td-p/34957&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/dedup-gives-different-result-if-a-table-command-is-used-before/td-p/253021" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/dedup-gives-different-result-if-a-table-command-is-used-before/td-p/253021&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/dedup-results-in-a-table-and-count-them/td-p/40339" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/dedup-results-in-a-table-and-count-them/td-p/40339&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 21:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512835#M143849</guid>
      <dc:creator>BB34</dc:creator>
      <dc:date>2020-08-06T21:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512873#M143867</link>
      <description>&lt;P&gt;If I understand you correctly, try using &lt;STRONG&gt;values(action)&lt;/STRONG&gt; rather than &lt;STRONG&gt;list(action)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512873#M143867</guid>
      <dc:creator>mfasciano_splun</dc:creator>
      <dc:date>2020-08-06T19:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512875#M143868</link>
      <description>&lt;P&gt;Awesome! but now crops up a new issue: my count of allowed/denied is busted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BB34_0-1596743860434.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10093i00F34F5C8163FD86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BB34_0-1596743860434.png" alt="BB34_0-1596743860434.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Going to keep messing with it, thank you for the prompt response!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 20:00:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512875#M143868</guid>
      <dc:creator>BB34</dc:creator>
      <dc:date>2020-08-06T20:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512881#M143871</link>
      <description>&lt;P&gt;Maybe you need a sum(count) rather than a list(count)?&amp;nbsp; I'm not sure what the overall goal is so sorry for the piece meal answers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 20:18:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512881#M143871</guid>
      <dc:creator>mfasciano_splun</dc:creator>
      <dc:date>2020-08-06T20:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512884#M143872</link>
      <description>&lt;P class="lia-align-left"&gt;No! thank for the responses! I'm making a search panel that we can input a website, from there the search tables the User, Action(allowed/denied), Count(of the action), and credentials entered.&lt;/P&gt;&lt;P class="lia-align-left"&gt;My current revised script is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;lt;search&amp;gt;
| stats count by user, status, http_method
| eval action=if(match(status,"^(2)([0-9]*)$"),"Allowed","Denied")
| stats   values(action) as Action, sum(count) as "Count" by  user http_method
| eval "Creds Entered"=if(http_method="POST","Yes","No") 
| table user Action Count "Creds Entered"&lt;/LI-CODE&gt;&lt;P&gt;Which outputs:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BB34_0-1596746311094.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10094i451B3D8A0F1A3A2F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BB34_0-1596746311094.png" alt="BB34_0-1596746311094.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I'm attempting to created is a table where all HTTP Status codes that = 2XX are "Allowed" while all others are "Denied", in the next column I want to have a count of "Allowed" and "Denied"&lt;/P&gt;&lt;P&gt;Excuse my crude example:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Action&lt;/TD&gt;&lt;TD width="50%"&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;P&gt;Allowed&lt;/P&gt;&lt;P&gt;Denied&lt;/P&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;P&gt;Allowed&lt;/P&gt;&lt;P&gt;Denied&lt;/P&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;120&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;P&gt;Allowed&lt;/P&gt;&lt;P&gt;Denied&lt;/P&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 06 Aug 2020 20:48:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/512884#M143872</guid>
      <dc:creator>BB34</dc:creator>
      <dc:date>2020-08-06T20:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/513153#M143972</link>
      <description>&lt;LI-CODE lang="markup"&gt;&amp;lt;search&amp;gt;
| eval Action=if(match(status,"^(2)([0-9]*)$"),"Allowed","Denied")
| stats count by user, Action, http_method
| eval tmp=if(http_method="POST","Yes","No") 
| stats list(Action) as Action list(count) as Count list(tmp) as "Creds Entered" by user&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This is better than before.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2020 15:51:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/513153#M143972</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-08T15:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup field values using if(match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/513386#M144035</link>
      <description>&lt;P&gt;Thanks for the input! We got Count to match up with Action but now we've split the Action&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BB34_0-1597070879314.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10175i99E33500EA1280C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BB34_0-1597070879314.png" alt="BB34_0-1597070879314.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It looks as though the split it due to the http_method:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BB34_1-1597073449615.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10176i40954073C45AFE08/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BB34_1-1597073449615.png" alt="BB34_1-1597073449615.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 15:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-field-values-using-if-quot-match-quot/m-p/513386#M144035</guid>
      <dc:creator>BB34</dc:creator>
      <dc:date>2020-08-10T15:33:07Z</dc:date>
    </item>
  </channel>
</rss>

