<?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 do I compare field results to counts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456107#M128962</link>
    <description>&lt;P&gt;You need to create a eval function for this&lt;/P&gt;

&lt;P&gt;| rex "^(?[^,]+),(?[^,]+),(?[^,]+),(?[^,]+),(?[^,\r\n])" | rex field=source "(?[^-])18" | rex "premisecount:\s(?\d+)" | rex field=source "(?[^]*).csv" | stats count sum(premisecount) as Prem by EVENT_ID,type  | eval Success =  if (restore  &amp;gt;= start , 1,0) |table ,EVENT_ID, type, Success &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:14:39 GMT</pubDate>
    <dc:creator>SathyaNarayanan</dc:creator>
    <dc:date>2020-09-29T21:14:39Z</dc:date>
    <item>
      <title>How do I compare field results to counts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456105#M128960</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
I have three communication types: Start, Update, Restore.&lt;/P&gt;

&lt;P&gt;Each event can have multiple communication types to multiple prems.  &lt;/P&gt;

&lt;P&gt;I am trying to declare success if the number of "restore" messages sent is equal or greater than the number of "start" messages.&lt;/P&gt;

&lt;P&gt;Event  486 would be a success and 393, 404 and 406 would fail.&lt;/P&gt;

&lt;P&gt;EVENT_ID    type    prem&lt;BR /&gt;
393                restore  434&lt;BR /&gt;
393                 start   474&lt;BR /&gt;
404             restore 21&lt;BR /&gt;
406                start    10&lt;BR /&gt;
406                restore  19&lt;BR /&gt;
486                restore  1&lt;BR /&gt;
486                 start   1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;&amp;lt;| transaction source, EVENT_ID 
| rex "^(?[^,]+),(?[^,]+),(?&amp;lt;code&amp;gt;[^,]+),(?[^,]+),(?[^,\r\n]*)"
| rex field=source "(?[^-]*)_18"  
| rex "premisecount:\s(?\d+)"
|  rex field=source "(?[^_]*).csv"
| stats count sum(premisecount) by EVENT_ID,type | rename "sum(premisecount)" as prem ]
|table ,EVENT_ID, type, prem&amp;gt;&amp;gt;
&amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 05:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456105#M128960</guid>
      <dc:creator>bcarnot</dc:creator>
      <dc:date>2018-09-12T05:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare field results to counts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456106#M128961</link>
      <description>&lt;P&gt;sorry 406 would be a success&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 05:37:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456106#M128961</guid>
      <dc:creator>bcarnot</dc:creator>
      <dc:date>2018-09-12T05:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare field results to counts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456107#M128962</link>
      <description>&lt;P&gt;You need to create a eval function for this&lt;/P&gt;

&lt;P&gt;| rex "^(?[^,]+),(?[^,]+),(?[^,]+),(?[^,]+),(?[^,\r\n])" | rex field=source "(?[^-])18" | rex "premisecount:\s(?\d+)" | rex field=source "(?[^]*).csv" | stats count sum(premisecount) as Prem by EVENT_ID,type  | eval Success =  if (restore  &amp;gt;= start , 1,0) |table ,EVENT_ID, type, Success &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:14:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456107#M128962</guid>
      <dc:creator>SathyaNarayanan</dc:creator>
      <dc:date>2020-09-29T21:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare field results to counts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456108#M128963</link>
      <description>&lt;P&gt;@SathyaNarayanan thank you for the response.  The recommendation returns all zeros.  I think this is because the count is by prem, not type.   How can one tie the two together?  The recommendation is exactly what is trying to be accomplished to count the successes and failures.&lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 15:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-field-results-to-counts/m-p/456108#M128963</guid>
      <dc:creator>bcarnot</dc:creator>
      <dc:date>2018-09-12T15:28:19Z</dc:date>
    </item>
  </channel>
</rss>

