<?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 use stats with condition from multiple fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659198#M227643</link>
    <description>&lt;P&gt;The idea is to find discrete count of id's where A=1, B=1. Not the count of events where&amp;nbsp; these values are 1.&lt;/P&gt;</description>
    <pubDate>Sat, 30 Sep 2023 15:22:32 GMT</pubDate>
    <dc:creator>Utkc137</dc:creator>
    <dc:date>2023-09-30T15:22:32Z</dc:date>
    <item>
      <title>How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659188#M227636</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Greetings,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with creating a table in splunk which would do the following transformation:&lt;/P&gt;&lt;P&gt;Find the discrete count of id for A, B, and C where value the is 1, by month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tt_3.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27394i87AD3B77629556D5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tt_3.png" alt="tt_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Currently, I am calculating values for each column individually using &lt;STRONG&gt;eventstats&lt;/STRONG&gt; and combining the results.&lt;/P&gt;&lt;P&gt;However, we have a lot of columns (a,b,c,d.....) and thus the SLP does not preform efficiently.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking for a more efficient approach to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 14:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659188#M227636</guid>
      <dc:creator>Utkc137</dc:creator>
      <dc:date>2023-09-30T14:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659190#M227637</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261081"&gt;@Utkc137&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the file name having values A, B and C is "id_cnt", you could use the chart command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| chart count OVER month BY id_cnt&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659190#M227637</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-30T15:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659191#M227638</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Are A,B,C,D fields?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659191#M227638</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-09-30T15:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659192#M227639</link>
      <description>&lt;P&gt;This isn't the case, all columns are individual fields values.&lt;/P&gt;&lt;P&gt;The original log is of the following format:&lt;/P&gt;&lt;P&gt;&amp;lt;date_time&amp;gt; &amp;lt;month&amp;gt; &amp;lt;id&amp;gt; A=1 B=0 C=0 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:09:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659192#M227639</guid>
      <dc:creator>Utkc137</dc:creator>
      <dc:date>2023-09-30T15:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659193#M227640</link>
      <description>&lt;P&gt;Yes, they are individual field values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:11:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659193#M227640</guid>
      <dc:creator>Utkc137</dc:creator>
      <dc:date>2023-09-30T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659195#M227641</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261081"&gt;@Utkc137&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you could try stats with eval:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| stats 
   count(eval(A=1)) AS A_id_cnt 
   count(eval(B=1)) AS B_id_cnt 
   count(eval(C=1)) AS C_id_cnt 
   BY month&lt;/LI-CODE&gt;&lt;P&gt;if it doesn't run, please try also:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| stats 
   count(eval(A="1")) AS A_id_cnt 
   count(eval(B="1")) AS B_id_cnt 
   count(eval(C="1")) AS C_id_cnt 
   BY month&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:14:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659195#M227641</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-30T15:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659197#M227642</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Please try below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats max(A) as ACnt, max(B) as BCnt, max(C) as CCnt by month, id
| stats sum(ACnt) as ACnt, sum(BCnt) as BCnt, sum(CCnt) as CCnt by month&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:21:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659197#M227642</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-09-30T15:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659198#M227643</link>
      <description>&lt;P&gt;The idea is to find discrete count of id's where A=1, B=1. Not the count of events where&amp;nbsp; these values are 1.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659198#M227643</guid>
      <dc:creator>Utkc137</dc:creator>
      <dc:date>2023-09-30T15:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659199#M227644</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261081"&gt;@Utkc137&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;sorry, what's the difference?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:24:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659199#M227644</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-30T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659200#M227645</link>
      <description>&lt;P&gt;Hey thanks a ton!&lt;BR /&gt;Been breaking my head on this issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659200#M227645</guid>
      <dc:creator>Utkc137</dc:creator>
      <dc:date>2023-09-30T15:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659201#M227646</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261081"&gt;@Utkc137&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659201#M227646</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-30T15:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats with condition from multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659203#M227647</link>
      <description>&lt;P&gt;Happy that worked for you!! Happy Splunking &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 15:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-with-condition-from-multiple-fields/m-p/659203#M227647</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-09-30T15:35:53Z</dc:date>
    </item>
  </channel>
</rss>

