<?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 Calculate duration between events. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185818#M53543</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a log file with many events like below&lt;/P&gt;

&lt;P&gt;2015-01-16 10:19:12 [APP1;STORE] Activated configuration 'Prod'&lt;BR /&gt;
2015-01-16 11:29:13 [APP1;STORE] Activated configuration 'Test'&lt;BR /&gt;
2015-01-16 12:30:51 [APP1;STORE] Activated configuration 'Prod'&lt;BR /&gt;
2015-01-16 15:50:03 [APP1;STORE] Activated configuration 'No Data'&lt;/P&gt;

&lt;P&gt;Each event indicates a configuration activation. so the time difference is the time the previous config was active. &lt;/P&gt;

&lt;P&gt;I'm extracting these fields&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Configuration&lt;/STRONG&gt;: values can be Prod, Test, No Data&lt;BR /&gt;
&lt;STRONG&gt;Application&lt;/STRONG&gt;: values can be APP1,APP2&lt;/P&gt;

&lt;P&gt;I want to calculate how long each configuration was active in APP1&lt;/P&gt;

&lt;P&gt;-Sreerag&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jan 2015 22:13:42 GMT</pubDate>
    <dc:creator>SreeragM</dc:creator>
    <dc:date>2015-01-16T22:13:42Z</dc:date>
    <item>
      <title>Calculate duration between events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185818#M53543</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a log file with many events like below&lt;/P&gt;

&lt;P&gt;2015-01-16 10:19:12 [APP1;STORE] Activated configuration 'Prod'&lt;BR /&gt;
2015-01-16 11:29:13 [APP1;STORE] Activated configuration 'Test'&lt;BR /&gt;
2015-01-16 12:30:51 [APP1;STORE] Activated configuration 'Prod'&lt;BR /&gt;
2015-01-16 15:50:03 [APP1;STORE] Activated configuration 'No Data'&lt;/P&gt;

&lt;P&gt;Each event indicates a configuration activation. so the time difference is the time the previous config was active. &lt;/P&gt;

&lt;P&gt;I'm extracting these fields&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Configuration&lt;/STRONG&gt;: values can be Prod, Test, No Data&lt;BR /&gt;
&lt;STRONG&gt;Application&lt;/STRONG&gt;: values can be APP1,APP2&lt;/P&gt;

&lt;P&gt;I want to calculate how long each configuration was active in APP1&lt;/P&gt;

&lt;P&gt;-Sreerag&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 22:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185818#M53543</guid>
      <dc:creator>SreeragM</dc:creator>
      <dc:date>2015-01-16T22:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration between events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185819#M53544</link>
      <description>&lt;P&gt;Does something like this work for you?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;config_value=prod OR config_value=Test OR config_value=No Data
application=APP1 OR application=APP2
| delta _time as tdelta
| stats list(tdelta) by application
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jan 2015 22:23:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185819#M53544</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-01-16T22:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration between events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185820#M53545</link>
      <description>&lt;P&gt;You could try this:&lt;/P&gt;

&lt;P&gt;yoursearchhere&lt;BR /&gt;
| sort _time&lt;BR /&gt;
| delta _time as Duration&lt;BR /&gt;
| table Application Configuration Duration&lt;BR /&gt;
| eventstats sum(Duration) as AppDuration by Application&lt;BR /&gt;
| fieldformat Duration=tostring(Duration,"duration")&lt;BR /&gt;
| fieldformat AppDuration=tostring(AppDuration,"duration")&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 22:40:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-duration-between-events/m-p/185820#M53545</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-01-16T22:40:33Z</dc:date>
    </item>
  </channel>
</rss>

