<?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: Average between 2 fields D+HH:MM:SS in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311623#M93378</link>
    <description>&lt;P&gt;Have you validated BBB and AAAA values are different or not?&lt;BR /&gt;
Can you add few data samples?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 16:31:58 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-02-20T16:31:58Z</dc:date>
    <item>
      <title>Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311620#M93375</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I try to realize an average enter 2 fields which appear in the form of D+HH:MM:SS so i converted with dur2sec. But the result is 0 i don't understand why. Can you help me to find why ? Thanks you.&lt;/P&gt;

&lt;P&gt;| convert dur2sec(AAAA) &lt;BR /&gt;
| convert dur2sec(BBB) &lt;BR /&gt;
|stats sum(AAA) as C sum(BBB) as D dc(E) as F&lt;BR /&gt;
| eval temps=D-C | eval moyen= temps/F&lt;BR /&gt;
| fields moyen&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 15:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311620#M93375</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-20T15:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311621#M93376</link>
      <description>&lt;P&gt;What is field E?  Counting a field that doesn't exist will make F=0&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 16:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311621#M93376</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-02-20T16:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311622#M93377</link>
      <description>&lt;P&gt;This field exist, E is an unique identifier on 1 event&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 16:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311622#M93377</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-20T16:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311623#M93378</link>
      <description>&lt;P&gt;Have you validated BBB and AAAA values are different or not?&lt;BR /&gt;
Can you add few data samples?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 16:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311623#M93378</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-02-20T16:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311624#M93379</link>
      <description>&lt;P&gt;Yes they are différents exemple : AAA = 2017-02-18 11:53:05&lt;BR /&gt;
                                                            BBB = 2017-02-18 11:53:14&lt;/P&gt;

&lt;P&gt;But no i can't add data sample .. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 16:37:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311624#M93379</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-20T16:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311625#M93380</link>
      <description>&lt;P&gt;You said that your field values are in format &lt;CODE&gt;D+HH:MM:SS&lt;/CODE&gt; (string formatted duration) but the sample values above shows that they are timestmap, which one is it? If it's timestamp then your convert dur2sec will fail and return 0/null. If they are timestamp, then give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your base search
| eval duration=strptime(BBB,"%Y-%m-%d %H:%M:%S")-strptime(AAA,"%Y-%m-%d %H:%M:%S")
|stats sum(duration) as duration dc(E) as F
| eval moyen= duration/F
| fields moyen
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 16:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311625#M93380</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-20T16:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311626#M93381</link>
      <description>&lt;P&gt;Okay ! Thanks for your help ! &lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 17:04:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311626#M93381</guid>
      <dc:creator>Abarny</dc:creator>
      <dc:date>2017-02-20T17:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Average between 2 fields D+HH:MM:SS</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311627#M93382</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval duration=strptime(BBB,"%Y-%m-%d %H:%M:%S") - strptime(AAA,"%Y-%m-%d %H:%M:%S")
|stats savg(duration) AS moyen
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 17:07:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-between-2-fields-D-HH-MM-SS/m-p/311627#M93382</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-02-20T17:07:56Z</dc:date>
    </item>
  </channel>
</rss>

