<?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: Eval field to get total count and plot the chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592172#M206128</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242839"&gt;@anu1729&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could add a streamstats command before the stats command to have the total events, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;base_search query 
| eval hqid = substr(requestURI,23,10) 
| fields hqid httpStatus 
| streamstats count AS total
| eval 
     status-success=if(httpStatus="200",1,0),
     status-fail=if(httpStatus != "200",1,0)
| stats sum(status_success) as status_success, sum(status_fail) as status_fail values(total) AS total by hqid 
|  eval status = case((status_fail=0 AND status_success&amp;gt;0), successful_logins, (status_fail&amp;gt;0 AND status_success&amp;gt;0), multi_success, (status_fail&amp;gt;0 AND status_success=0), multi_fail,  (status_fail&amp;gt;0), fail,1=1, Other)
| eval not_logged_in=total-successful_logins-multi_success-multi_fail-Other&lt;/LI-CODE&gt;&lt;P&gt;Don't use "-" in the field names, use always "_", so you don't need to use quotes.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2022 10:03:58 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-04-04T10:03:58Z</dc:date>
    <item>
      <title>How to search Eval field to get total count and plot the chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592168#M206126</link>
      <description>&lt;DIV&gt;&amp;nbsp;We want to get the number of successful login, multiple successful login, multi-fail logins and also number the of hqid which has not logged in i.e (total number of hqid - sum(successful login + multiple successful login + multi fail).&lt;/DIV&gt;
&lt;DIV&gt;We have written below query, and we are able to get the number of successful login, multi-success login and as well multi-fail but I am not sure how to get the number for not logged-in case. Could anyone please help me here&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;LI-CODE lang="markup"&gt;base_search query | eval hqid = substr(requestURI,23,10) | table hqid httpStatus | eval status-success=if(httpStatus="200",1,0) | eval status-fail= if(httpStatus != "200",1,0)
| stats sum(status-success) as status-success, sum(status-fail) as status-fail by hqid |  eval status = case(('status-fail'=0 AND 'status-success'&amp;gt;0), "successful-logins",  ('status-fail'&amp;gt;0 AND 'status-success'&amp;gt;0), "multi-success", ('status-fail'&amp;gt;0 AND 'status-success'=0), "multi-fail",  ('status-fail'&amp;gt;0), "fail",1=1, "Other"  &lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592168#M206126</guid>
      <dc:creator>anu1729</dc:creator>
      <dc:date>2022-04-04T14:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592170#M206127</link>
      <description>&lt;P&gt;If httpStatus isn't present in the event, it doesn't get counted. You could try counting all the events which don't have httpStatus and include that in your total?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval status-success=if(httpStatus="200",1,0)
| eval status-fail= if(httpStatus != "200",1,0)
| eval status-missing= if(isnull(httpStatus),1,0)
| stats sum(status-success) as status-success, sum(status-fail) as status-fail sum(status-missing) as status-missing by hqid&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Apr 2022 10:00:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592170#M206127</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-04T10:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592172#M206128</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242839"&gt;@anu1729&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could add a streamstats command before the stats command to have the total events, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;base_search query 
| eval hqid = substr(requestURI,23,10) 
| fields hqid httpStatus 
| streamstats count AS total
| eval 
     status-success=if(httpStatus="200",1,0),
     status-fail=if(httpStatus != "200",1,0)
| stats sum(status_success) as status_success, sum(status_fail) as status_fail values(total) AS total by hqid 
|  eval status = case((status_fail=0 AND status_success&amp;gt;0), successful_logins, (status_fail&amp;gt;0 AND status_success&amp;gt;0), multi_success, (status_fail&amp;gt;0 AND status_success=0), multi_fail,  (status_fail&amp;gt;0), fail,1=1, Other)
| eval not_logged_in=total-successful_logins-multi_success-multi_fail-Other&lt;/LI-CODE&gt;&lt;P&gt;Don't use "-" in the field names, use always "_", so you don't need to use quotes.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 10:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592172#M206128</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-04T10:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592178#M206130</link>
      <description>&lt;P&gt;streamstats is giving the total count at that time, but we need to get the not-logged -in value as we have fixed number of hqid &amp;nbsp;and we want to check how many of them have not logged and how many of them are able to successfully log in , or multi-fail is happening, or multi-success&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 10:26:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592178#M206130</guid>
      <dc:creator>anu1729</dc:creator>
      <dc:date>2022-04-04T10:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592180#M206131</link>
      <description>&lt;P&gt;So you are trying to count events that haven't happened? Essentially, you need to create some events which splunk can count or simply tell splunk what the total should be.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 10:54:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592180#M206131</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-04T10:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592197#M206134</link>
      <description>&lt;P&gt;Yes we are trying to get the count for those event which has not happened. &amp;nbsp;we have used the below query to get the count of not-logged-in but we are not able to club with the eval statement for status.&lt;/P&gt;&lt;P&gt;| eval hqid = substr(requestURI,23,10) | table hqid httpStatus | eval status_success=if(httpStatus="200",1,0) | eval status_fail= if(httpStatus != "200",1,0) | stats sum(status_success) as status_success, sum(status_fail) as status_fail by hqid | eval status = case((status_fail&amp;gt;0 AND 'status_success'&amp;gt;0), "multiple successful logins", ('status_fail'&amp;gt;0), "multi fail", ('status_success'&amp;gt;0), "successfull login",1=1, "Other") | eval logged_in = status_success+status_fail | eval not_logged_in = 28-logged_in&lt;/P&gt;&lt;P&gt;we want the output to be in stacked form , like on a particular date how many of them were successful, multi-fail, multi-success and not logged in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 12:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592197#M206134</guid>
      <dc:creator>anu1729</dc:creator>
      <dc:date>2022-04-04T12:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592215#M206135</link>
      <description>&lt;P&gt;Do you know all the hqids that you have that could potentially try to login?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 13:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592215#M206135</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-04T13:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592226#M206137</link>
      <description>&lt;P&gt;yes&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592226#M206137</guid>
      <dc:creator>anu1729</dc:creator>
      <dc:date>2022-04-04T14:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592231#M206140</link>
      <description>&lt;P&gt;In that case, you should include them in your search so you can count them.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 15:03:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592231#M206140</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-04T15:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592240#M206143</link>
      <description>&lt;P&gt;how to include that and how we will get data in the stacked format.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 15:23:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592240#M206143</guid>
      <dc:creator>anu1729</dc:creator>
      <dc:date>2022-04-04T15:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Eval field to get total count and plot the chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592244#M206144</link>
      <description>&lt;P&gt;It depends where you data is and how much of it there is. You can use append but you are limited to the number of events you can add the the pipeline in a single append, although you can use multiple appends.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 15:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-Eval-field-to-get-total-count-and-plot-the-chart/m-p/592244#M206144</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-04T15:34:07Z</dc:date>
    </item>
  </channel>
</rss>

