<?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: Show eventstats over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627375#M218010</link>
    <description>&lt;P&gt;Try adding a time element to your search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*group*") OR (index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*User*")
| where match(userPrincipalName,"domain name") or match(userPrincipalName,"domain name")
| bin _time span=1d
| eventstats count by id _time
| eventstats count(eval((source="rest://MSGraph Group1 Members" OR (source="rest://MSGraph Group 2 Members") or (source="rest://MSGraph Group 3 Members") ))) as total by _time
| eventstats count(eval(source="rest://MSGraph CL Users" AND count&amp;gt;1)) as current by _time
| dedup total, current, _time
| eval perc=round(current*100/total,1)."%"
| eval missing=total-current

| rename total as "In Scope Users"
| rename current as "Current Users"
| rename perc as "Percent Compliant"
| rename missing as "Missing"
|  table _time, "In Scope Users", "Current Users", "Missing", "Percent Compliant"&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 17 Jan 2023 16:52:37 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-01-17T16:52:37Z</dc:date>
    <item>
      <title>How to show eventstats over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627372#M218006</link>
      <description>&lt;P&gt;i currently have a query that returns what I need for a single day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;( index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*group*") OR (index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*User*")
| where match(userPrincipalName,"domain name") or match(userPrincipalName,"domain name")
| eventstats count by id
| eventstats count(eval((source="rest://MSGraph Group1 Members" OR (source="rest://MSGraph Group 2 Members") or (source="rest://MSGraph Group 3 Members") ))) as total
| eventstats count(eval(source="rest://MSGraph CL Users" AND count&amp;gt;1)) as current
| dedup total, current
| eval perc=round(current*100/total,1)."%"
| eval missing=total-current

| rename total as "In Scope Users"
| rename current as "Current Users"
| rename perc as "Percent Compliant"
| rename missing as "Missing"
|  table "In Scope Users", "Current Users", "Missing", "Percent Compliant"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying to make this show me a chart over the previous month that show me the daily result of the posted query.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I have tried many "solutions" from the web, but nothing has worked.&amp;nbsp; Any help is appreciated&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627372#M218006</guid>
      <dc:creator>mikem</dc:creator>
      <dc:date>2023-01-17T20:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Show eventstats over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627375#M218010</link>
      <description>&lt;P&gt;Try adding a time element to your search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*group*") OR (index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*User*")
| where match(userPrincipalName,"domain name") or match(userPrincipalName,"domain name")
| bin _time span=1d
| eventstats count by id _time
| eventstats count(eval((source="rest://MSGraph Group1 Members" OR (source="rest://MSGraph Group 2 Members") or (source="rest://MSGraph Group 3 Members") ))) as total by _time
| eventstats count(eval(source="rest://MSGraph CL Users" AND count&amp;gt;1)) as current by _time
| dedup total, current, _time
| eval perc=round(current*100/total,1)."%"
| eval missing=total-current

| rename total as "In Scope Users"
| rename current as "Current Users"
| rename perc as "Percent Compliant"
| rename missing as "Missing"
|  table _time, "In Scope Users", "Current Users", "Missing", "Percent Compliant"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627375#M218010</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-17T16:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to show eventstats over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627408#M218023</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252972"&gt;@mikem&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;your search is going to be massively inefficient. eventstats is a slow command and you are running it 3 times across the data and then using dedup to aggregate.&lt;/P&gt;&lt;P&gt;You should try to use stats where possible and in this case, I believe you can achieve the same with stats.&lt;/P&gt;&lt;P&gt;This uses 2 stats commands and also splits by day. I think it should give the same results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*group*") OR (index=microsoftcloud sourcetype="ms:azure:accounts" source="rest*User*")
| where match(userPrincipalName,"domain name") or match(userPrincipalName,"domain name")

| bin _time span=1d
| stats count(eval((source="rest://MSGraph Group1 Members" OR (source="rest://MSGraph Group 2 Members") or (source="rest://MSGraph Group 3 Members") ))) as total count(eval(source="rest://MSGraph CL Users")) as current by _time id
``` If id count was 1, then current will be 0 ```
| eval current=if(count&amp;lt;=1, 0, current)
``` this will calculate your original total ```
| stats sum(count) as total sum(current) as current by _time

| eval perc=round(current*100/total,1)."%"
| eval missing=total-current

| rename total as "In Scope Users"
| rename current as "Current Users"
| rename perc as "Percent Compliant"
| rename missing as "Missing"
|  table "In Scope Users", "Current Users", "Missing", "Percent Compliant"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 02:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627408#M218023</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-01-18T02:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to show eventstats over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627460#M218036</link>
      <description>&lt;P&gt;i had thought this would work, and had tried something similar before using eventstats.&amp;nbsp; &amp;nbsp;when I execute this nothing is returned.&lt;/P&gt;&lt;P&gt;I am wondering if this is because the data is populated by API calls and the timestamps on the data are when the API call was executed.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;the dedup is to cleanup if the API call was run more than once in a 24h period&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 13:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627460#M218036</guid>
      <dc:creator>mikem</dc:creator>
      <dc:date>2023-01-18T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to show eventstats over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627538#M218060</link>
      <description>&lt;P&gt;In order to see why it doesn't work - start with taking line by line and adding the next line and see what your data looks like at that point.&lt;/P&gt;&lt;P&gt;You search for data with a time range and that means _time MUST be within that range to be found. If _time is the API call time, does the data have its own timestamp other than the one for the API call.&lt;/P&gt;&lt;P&gt;However, there is always _time, so it should return something. If you want to explore how to make this work, please post the query and results at various points when it goes from data to no data.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 03:00:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627538#M218060</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-01-19T03:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to show eventstats over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627586#M218073</link>
      <description>&lt;P&gt;i walked thru this line by line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;had to break up the total collection into&lt;/P&gt;&lt;P&gt;| stats count(eval(source="rest://MSGraph Group1 Members")) as total1 count(eval(source="rest://MSGraph Group 2 Members")) as total2 count(eval(source="rest://MSGraph Group 3 Members")) as total3 count(eval(source="rest://MSGraph CL Users")) as current by _time id&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval total=total1+total2+total3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 13:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-show-eventstats-over-time/m-p/627586#M218073</guid>
      <dc:creator>mikem</dc:creator>
      <dc:date>2023-01-19T13:44:38Z</dc:date>
    </item>
  </channel>
</rss>

