<?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 How do I aggregate events using 2 different timestamps? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281067#M84819</link>
    <description>&lt;P&gt;I am looking to "segment" operational changes(events) based on both the &lt;STRONG&gt;CLOSEDDATE&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;OPENDATE&lt;/STRONG&gt; and essentially calculate the total number of changes in the month of March based on CLOSEDATE into one column and then OPENDATE for another column&lt;/P&gt;

&lt;P&gt;I have created a stats table based on OPENDATE where I segment the events into different time buckets:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time=strptime(OPENDATETIME,"%Y-%m-%d %H:%M:%S")    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I run a stats command on the events indexed using OPENDATE and then use appendcols to filter events that occurred in the last month using CLOSEDDATE?&lt;/P&gt;

&lt;P&gt;Or is there a better way to do this?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2016 17:06:53 GMT</pubDate>
    <dc:creator>magenta</dc:creator>
    <dc:date>2016-04-11T17:06:53Z</dc:date>
    <item>
      <title>How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281067#M84819</link>
      <description>&lt;P&gt;I am looking to "segment" operational changes(events) based on both the &lt;STRONG&gt;CLOSEDDATE&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;OPENDATE&lt;/STRONG&gt; and essentially calculate the total number of changes in the month of March based on CLOSEDATE into one column and then OPENDATE for another column&lt;/P&gt;

&lt;P&gt;I have created a stats table based on OPENDATE where I segment the events into different time buckets:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time=strptime(OPENDATETIME,"%Y-%m-%d %H:%M:%S")    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I run a stats command on the events indexed using OPENDATE and then use appendcols to filter events that occurred in the last month using CLOSEDDATE?&lt;/P&gt;

&lt;P&gt;Or is there a better way to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 17:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281067#M84819</guid>
      <dc:creator>magenta</dc:creator>
      <dc:date>2016-04-11T17:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281068#M84820</link>
      <description>&lt;P&gt;Assuming you events will have either the OPENDATETIME OR CLOSEDDATETIME, you could do &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | eval openmonth=strftime(OPENDATETIME, "%m") | eval closedmonth=strftime(OPENDATETIME, "%m") | where openmonth="04" OR closedmonth="04" | stats count(OPENDATETIME) as open count(CLOSEDDATETIME) as closed 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Apr 2016 18:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281068#M84820</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-11T18:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281069#M84821</link>
      <description>&lt;P&gt;Do both CLOSEDATE and OPENDATE field appear on the same event?? Are you looking for how many new changes opened in March and how many closed in March?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 19:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281069#M84821</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-11T19:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281070#M84822</link>
      <description>&lt;P&gt;Ignore any feelings about implementation approaches: What &lt;EM&gt;exactly&lt;/EM&gt; are you trying to do?  Show sample events, and desired output.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2016 05:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281070#M84822</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-12T05:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281071#M84823</link>
      <description>&lt;P&gt;Each event has both OPENDATETIME &amp;amp; CLOSEDDATETIME so i'm looking to actually create a table by business process that includes the following fields:&lt;BR /&gt;
1)  changes opened in march (based on opendate)&lt;BR /&gt;
2) changes opened in march leading to errors (based on opendate)&lt;BR /&gt;
2) changes opened in march (based on closeddate)&lt;/P&gt;

&lt;P&gt;All shown by Business process  - so the question is can i use STATS to count by OPENDATE (using _time=OPENDATETIME) and then index by CLOSEDDATETIME and count again?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2016 17:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281071#M84823</guid>
      <dc:creator>magenta</dc:creator>
      <dc:date>2016-04-12T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I aggregate events using 2 different timestamps?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281072#M84824</link>
      <description>&lt;P&gt;I would try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval OpenMonth=strftime(strptime(OPENDATETIME,"%Y-%m-%d %H:%M:%S") ,"%Y-%m") | eval ClosedMonth=strftime(strptime(CLOSEDATETIME,"%Y-%m-%d %H:%M:%S") ,"%Y-%m") | eval OpenedInMarch=if(OpenMonth="2016-03",1,0) | eval ClosedInMarch=if(ClosedMonth="2016-03",1,0) | stats sum(OpenedInMarch) as OpenedInMarch sum(ClosedInMarch) as ClosedInMarch
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Apr 2016 19:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-aggregate-events-using-2-different-timestamps/m-p/281072#M84824</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-12T19:11:46Z</dc:date>
    </item>
  </channel>
</rss>

