<?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: field calculation help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481827#M193124</link>
    <description>&lt;P&gt;didnt understand to which part of my post it is referring to ...&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2020 10:19:14 GMT</pubDate>
    <dc:creator>sarit_s</dc:creator>
    <dc:date>2020-04-22T10:19:14Z</dc:date>
    <item>
      <title>field calculation help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481825#M193122</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;

&lt;P&gt;i have this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as daily_count summariesonly=true allow_old_summaries=true from datamodel="events_prod"
    by events.eventtype events.tail_id sourcetype _time span=1d
| eval day=strftime(_time, "%Y-%m-%d")
    | multireport  [ table daily_count, events.eventtype, day, events.tail_id, sourcetype]
    [ stats values(events.eventtype) as events.eventtype, values(day) as day,
    values(events.tail_id) as events.tail_id
    | mvexpand events.eventtype   | mvexpand day | mvexpand events.tail_id | eval daily_count=0 ]
    | eventstats first(sourcetype) as sourcetype by events.eventtype
    | stats first(daily_count) as daily_count by events.eventtype, day, events.tail_id, sourcetype
|rename day as _time
 | streamstats sum(daily_count) as general by events.tail_id sourcetype time_window=30d  | where general!=0  | streamstats sum(daily_count) as monthly_count by events.eventtype events.tail_id time_window=30d
| table events.eventtype, monthly_count  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which calculate number of events for each eventType for period of 30 days . also its needed to add to the calculation days with no events so i've added to the query days with number of events=0&lt;/P&gt;

&lt;P&gt;I want to clear from the calculation raws that there is no events from their sourcetype and their tail_id for the last 30 days and clear the raws that their daily calculation = 0 in the empty time period&lt;/P&gt;

&lt;P&gt;what should i add to my query ?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 09:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481825#M193122</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-04-22T09:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: field calculation help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481826#M193123</link>
      <description>&lt;P&gt;&lt;CODE&gt;tstats&lt;/CODE&gt; needs &lt;CODE&gt;prestats=t&lt;/CODE&gt; option.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 09:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481826#M193123</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-22T09:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: field calculation help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481827#M193124</link>
      <description>&lt;P&gt;didnt understand to which part of my post it is referring to ...&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 10:19:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481827#M193124</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-04-22T10:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: field calculation help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481828#M193125</link>
      <description>&lt;P&gt;see reference&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 10:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-calculation-help/m-p/481828#M193125</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-22T10:28:54Z</dc:date>
    </item>
  </channel>
</rss>

