<?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: How to create a new field and set it with a value of 5 minutes for each event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230455#M68319</link>
    <description>&lt;P&gt;It seems a good try, but where I should set the duration of 5 minutes per event?&lt;/P&gt;

&lt;P&gt;Also, I check it in my code, and there is a new field called new_duration, which is good, but I don't know why, TotalDuration appears empty :S &lt;/P&gt;

&lt;P&gt;I have problem with sum(X) and avg(X) with stats, I think they worked but my results appear empty the most of times, and I don't understand why.&lt;/P&gt;

&lt;P&gt;Thanks a lot, you're being really helpful! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2016 08:42:10 GMT</pubDate>
    <dc:creator>marina_rovira</dc:creator>
    <dc:date>2016-01-13T08:42:10Z</dc:date>
    <item>
      <title>How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230452#M68316</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I'm making an alerts report and by now, I have the total number of Alerts for a month, let's set it as 10,000.&lt;BR /&gt;
Now, I want to set an estimated time spent for all these alerts. To do that, I need to create a field with the value of 5 minutes for each Alert (is more or less the time I think the people spent handling this).&lt;/P&gt;

&lt;P&gt;I want to set it for then, sum up the field for each event and get the estimated time as 10,000 alerts * 5 minutes (+or-) for alert = 50,000 minutes ~ 833 hours &lt;/P&gt;

&lt;P&gt;For now, I've done this and it seems to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval startofevent=strptime(strftime(_time, "%Y/%m/%d 00:00:00"), "%Y/%m/%d %H:%M:%S") | eval endofevent=strptime(strftime(_time, "%Y/%m/%d 00:05:00"), "%Y/%m/%d %H:%M:%S") | eval new_duration=endofevent-startofevent  | stats count(Alert) as TotalAlerts sum(new_duration) as Total_time |  eval TotalDuration = tostring(Total_time, "duration") | table TotalAlerts,TotalDuration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It give the result as &lt;CODE&gt;DD+HH:MM:SS.00000&lt;/CODE&gt; and I would like it without &lt;CODE&gt;.00000&lt;/CODE&gt; or in some friendly format, so If someone has a suggestion to do it in a better way, it will be welcomed! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thank you! &lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 15:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230452#M68316</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-01-12T15:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230453#M68317</link>
      <description>&lt;P&gt;I might be misunderstanding your requirement... but why don't you just do an eval after your stats count?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count(Alert) as TotalAlerts | eval Total_time = TotalAlerts * 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this doesn't work for you please explain further your requirement.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 16:06:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230453#M68317</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2016-01-12T16:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230454#M68318</link>
      <description>&lt;P&gt;You could try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats range(_time) as new_duration | stats count(Alert) as TotalAlerts sum(new_duration) as Total_time | eval Total_time =tostring(round(Total_time , 0), "duration") | table TotalAlerts,TotalDuration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Streamstats"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Streamstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/Commonstatsfunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/Commonstatsfunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 16:10:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230454#M68318</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-12T16:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230455#M68319</link>
      <description>&lt;P&gt;It seems a good try, but where I should set the duration of 5 minutes per event?&lt;/P&gt;

&lt;P&gt;Also, I check it in my code, and there is a new field called new_duration, which is good, but I don't know why, TotalDuration appears empty :S &lt;/P&gt;

&lt;P&gt;I have problem with sum(X) and avg(X) with stats, I think they worked but my results appear empty the most of times, and I don't understand why.&lt;/P&gt;

&lt;P&gt;Thanks a lot, you're being really helpful! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 08:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230455#M68319</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-01-13T08:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230456#M68320</link>
      <description>&lt;P&gt;It's something like this, I've tried, but I think the final result is not correct. Maybe because we are not setting that this 5 is 5 minutes or I don't knwo why. I keep trying this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks! &lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 08:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230456#M68320</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-01-13T08:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230457#M68321</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count as TotalAlerts | eval Total_time = tostring(TotalAlerts*5, "duration") | table TotalAlerts, Total_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2016 12:40:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230457#M68321</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-13T12:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230458#M68322</link>
      <description>&lt;P&gt;I saw you had another question about finding the average. If this is related, I would change the search to this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats count as TotalAlerts | eval Total_time = TotalAlerts*5 | stats avg(Total_time) as AvgTime | fieldformat AvgTime =tostring(AvgTime, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2016 13:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230458#M68322</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-13T13:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230459#M68323</link>
      <description>&lt;P&gt;At this one the average is not a theme. I tried what you said before and the results are these:&lt;/P&gt;

&lt;P&gt;TotalAlerts         Total_time&lt;BR /&gt;
25211                    1+11:00:55 &lt;/P&gt;

&lt;P&gt;I want to set a new field of 5 minuts for  each alert, but the results doesn't seems realistic to me, I mean 5 minuts for 25211 alerts, seems quite difficult that the total spent time handling alerts is 1 day and 11 hours :S&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 13:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230459#M68323</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-01-13T13:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new field and set it with a value of 5 minutes for each event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230460#M68324</link>
      <description>&lt;P&gt;I was calculating and I think I am wrong and the result is correct like this. I just realised, if now I am correct, that it let's the time in seconds although I'm setting 5 minutes. And calculating  (((Total_time/60)/60)/24) It give this "1+11:00:55"&lt;/P&gt;

&lt;P&gt;I get it! Thanks for you comments! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 13:50:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-new-field-and-set-it-with-a-value-of-5-minutes/m-p/230460#M68324</guid>
      <dc:creator>marina_rovira</dc:creator>
      <dc:date>2016-01-13T13:50:09Z</dc:date>
    </item>
  </channel>
</rss>

