<?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: count if two nonconsecutive string occurs in a statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475844#M192600</link>
    <description>&lt;P&gt;I just tried to re-run the query and doesn;t look like it is giving the data.. I fi run this query it does give me data&lt;/P&gt;

&lt;P&gt;("String1" AND "String2") | timechart count span=1h |sort -_time&lt;/P&gt;

&lt;P&gt;Can you please review your query above once&lt;/P&gt;</description>
    <pubDate>Wed, 15 Apr 2020 16:21:41 GMT</pubDate>
    <dc:creator>ataunk</dc:creator>
    <dc:date>2020-04-15T16:21:41Z</dc:date>
    <item>
      <title>count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475840#M192596</link>
      <description>&lt;P&gt;I want to write a query to take the count if two non-consecutive string occurs in a statement. I am trying to do something like this, but this is not able to take logical AND operator in the match method :&lt;/P&gt;

&lt;P&gt;Note : I want to use the query using eval only as in my larger query I have to perform some mathematical operation using more (different) eval variables.&lt;/P&gt;

&lt;P&gt;| eval concatsearch=if(match(_raw,"String1 &amp;amp;&amp;amp; String2"),1,0) |&lt;BR /&gt;
eval ccount=if(match(_raw,"cc"),1,0) | &lt;BR /&gt;
timechart span=1h &lt;BR /&gt;
sum(concatsearch) as concatsearch,&lt;BR /&gt;
sum(ccount) as ccount&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475840#M192596</guid>
      <dc:creator>ataunk</dc:creator>
      <dc:date>2020-09-30T05:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475841#M192597</link>
      <description>&lt;P&gt;There are many ways to do that, but this one should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | eval concatsearch=if(match(_raw,"String1"),1,0)*if(match(_raw,"String2"),1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If either string is not matched, a zero value will result, if both match, a 1 value will result.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 17:13:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475841#M192597</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-04-14T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475842#M192598</link>
      <description>&lt;P&gt;Thanks so much. It works. Love Splunk comunity.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 17:17:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475842#M192598</guid>
      <dc:creator>ataunk</dc:creator>
      <dc:date>2020-04-14T17:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475843#M192599</link>
      <description>&lt;P&gt;Yeah, me too.  Okay, if that solved your problem, then please "accept" the answer, so it will show as solved.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 15:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475843#M192599</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-04-15T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475844#M192600</link>
      <description>&lt;P&gt;I just tried to re-run the query and doesn;t look like it is giving the data.. I fi run this query it does give me data&lt;/P&gt;

&lt;P&gt;("String1" AND "String2") | timechart count span=1h |sort -_time&lt;/P&gt;

&lt;P&gt;Can you please review your query above once&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 16:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475844#M192600</guid>
      <dc:creator>ataunk</dc:creator>
      <dc:date>2020-04-15T16:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: count if two nonconsecutive string occurs in a statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475845#M192601</link>
      <description>&lt;P&gt;Also, the entire query I am running is :&lt;/P&gt;

&lt;P&gt;| eval concatsearch=if(match(_raw,"String1"),1,0)*if(match(_raw,"String2"),1,0)&lt;BR /&gt;
| timechart sum(concatsearch) span=1h&lt;/P&gt;

&lt;P&gt;And I get 0 results, but those string are actually there. Am I doing something worng while using the sum and timechat ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:57:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-if-two-nonconsecutive-string-occurs-in-a-statement/m-p/475845#M192601</guid>
      <dc:creator>ataunk</dc:creator>
      <dc:date>2020-09-30T04:57:29Z</dc:date>
    </item>
  </channel>
</rss>

