<?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: Sum of conditional if with wildcard in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251973#M75345</link>
    <description>&lt;P&gt;So, this is sort of working I think... but it seems like my group is only returning one column for each user.. so I will get a count of type2_if_total for a given user I won't get a count of type1_if_total or visa versa.   I need to know the total count of both type1_if_total and type2_if_total for each user.  &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:26:27 GMT</pubDate>
    <dc:creator>jclemons7</dc:creator>
    <dc:date>2020-09-29T07:26:27Z</dc:date>
    <item>
      <title>Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251970#M75342</link>
      <description>&lt;P&gt;Hello all, &lt;/P&gt;

&lt;P&gt;I have the following search and I can't seem to "trick" it into giving me the data I want... Essentially, I want a table by timestamp and user which counts occurrences of wildcard hits.  Here's my lame attempt to get it working.. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event="standard"
| regex _raw!=(?i)"(fileofinterest.txt|objectofinterest.txt|otherthing.bat)"
| eval type1_if=if(InterestingField="%fileofinterest.txt%", 1, 0)
| eval type2_if=if(InterestingField="%objectofinterest.txt%", 1, 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to get a table that looks like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_timestamp | user | type1_if_total | type2_if_total | type_if_total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For each user and _timestamp&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated... &lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 20:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251970#M75342</guid>
      <dc:creator>jclemons7</dc:creator>
      <dc:date>2015-10-01T20:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251971#M75343</link>
      <description>&lt;P&gt;I think you are not asking for what you really desire but assuming I am incorrect, you can what you asked like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event="standard"
| regex _raw!=(?i)"(fileofinterest.txt|objectofinterest.txt|otherthing.bat)"
| stats count(eval(match(InterestingField,"%fileofinterest.txt%") AS type1_if_total 
count(eval(match(InterestingField, "%objectofinterest.txt%") AS type2_if_total BY _timestamp user
| eval type_if_total = type1_if_total + type2_if_total 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2015 20:24:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251971#M75343</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-01T20:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251972#M75344</link>
      <description>&lt;P&gt;Any sample logs??&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 22:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251972#M75344</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-01T22:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251973#M75345</link>
      <description>&lt;P&gt;So, this is sort of working I think... but it seems like my group is only returning one column for each user.. so I will get a count of type2_if_total for a given user I won't get a count of type1_if_total or visa versa.   I need to know the total count of both type1_if_total and type2_if_total for each user.  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:26:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251973#M75345</guid>
      <dc:creator>jclemons7</dc:creator>
      <dc:date>2020-09-29T07:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251974#M75346</link>
      <description>&lt;P&gt;something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count(eval(type1_if=1)) as type1_if count(eval(type2_if=1)) as type2_if count(eval(type1_if=1 OR type2_if=1)) as type_if by _timestamp user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Oct 2015 16:31:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251974#M75346</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2015-10-02T16:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of conditional if with wildcard</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251975#M75347</link>
      <description>&lt;P&gt;If you are only getting a count of one it is because that is what is really there.   If a user has some of each, this search &lt;EM&gt;WILL&lt;/EM&gt; count both and each field will be non-zero.  My solution is a complete solution for your need as you described it.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2015 18:47:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-conditional-if-with-wildcard/m-p/251975#M75347</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-16T18:47:39Z</dc:date>
    </item>
  </channel>
</rss>

