<?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 to generate a search to calculate the duration when a pressure value drops below a certain threshold? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277106#M83572</link>
    <description>&lt;P&gt;Hi, assume I have the following type of data for pressure sensors in multiple sites.  What we need to do (preferably without using transactions) is calculate the duration for a site, UID when the pressure value drops below say 3 as a threshold.  Any help or ideas appreciated.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date              Time  Site    UID Pressure
01/02/2017  12:01:00    abc 123 3.2
01/02/2017  12:02:00    abc 123 3.1
01/02/2017  12:03:00    abc 123 3
01/02/2017  12:04:00    abc 123 2.9
01/02/2017  12:05:00    abc 123 2.9
01/02/2017  12:06:00    abc 123 3.2
01/02/2017  12:07:00    abc 234 3
01/02/2017  12:08:00    abc 234 2.6
01/02/2017  12:09:00    abc 234 2.6
01/02/2017  12:10:00    abc 234 2.5
01/02/2017  12:01:00    def 123 3.2
01/02/2017  12:02:00    def 123 3.1
01/02/2017  12:03:00    def 123 3
01/02/2017  12:04:00    ghi 123 2.9
01/02/2017  12:05:00    ghi 123 2.9
01/02/2017  12:06:00    ghi 123 3.2
01/02/2017  12:07:00    ghi 234 3
01/02/2017  12:08:00    ghi 234 2.6
01/02/2017  12:09:00    ghi 234 2.6
01/02/2017  12:10:00    ghi 234 2.5
01/02/2017  12:11:12    ghi 234 3
01/02/2017  12:12:22    ghi 234 3.1
01/02/2017  12:13:12    ghi 234 3.2
02/02/2017  10:12:12    ghi 234 2.9
02/02/2017  10:13:12    ghi 234 3
02/02/2017  10:14:32    ghi 234 31
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Feb 2017 22:20:03 GMT</pubDate>
    <dc:creator>westonaj1</dc:creator>
    <dc:date>2017-02-03T22:20:03Z</dc:date>
    <item>
      <title>How to generate a search to calculate the duration when a pressure value drops below a certain threshold?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277106#M83572</link>
      <description>&lt;P&gt;Hi, assume I have the following type of data for pressure sensors in multiple sites.  What we need to do (preferably without using transactions) is calculate the duration for a site, UID when the pressure value drops below say 3 as a threshold.  Any help or ideas appreciated.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date              Time  Site    UID Pressure
01/02/2017  12:01:00    abc 123 3.2
01/02/2017  12:02:00    abc 123 3.1
01/02/2017  12:03:00    abc 123 3
01/02/2017  12:04:00    abc 123 2.9
01/02/2017  12:05:00    abc 123 2.9
01/02/2017  12:06:00    abc 123 3.2
01/02/2017  12:07:00    abc 234 3
01/02/2017  12:08:00    abc 234 2.6
01/02/2017  12:09:00    abc 234 2.6
01/02/2017  12:10:00    abc 234 2.5
01/02/2017  12:01:00    def 123 3.2
01/02/2017  12:02:00    def 123 3.1
01/02/2017  12:03:00    def 123 3
01/02/2017  12:04:00    ghi 123 2.9
01/02/2017  12:05:00    ghi 123 2.9
01/02/2017  12:06:00    ghi 123 3.2
01/02/2017  12:07:00    ghi 234 3
01/02/2017  12:08:00    ghi 234 2.6
01/02/2017  12:09:00    ghi 234 2.6
01/02/2017  12:10:00    ghi 234 2.5
01/02/2017  12:11:12    ghi 234 3
01/02/2017  12:12:22    ghi 234 3.1
01/02/2017  12:13:12    ghi 234 3.2
02/02/2017  10:12:12    ghi 234 2.9
02/02/2017  10:13:12    ghi 234 3
02/02/2017  10:14:32    ghi 234 31
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2017 22:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277106#M83572</guid>
      <dc:creator>westonaj1</dc:creator>
      <dc:date>2017-02-03T22:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to calculate the duration when a pressure value drops below a certain threshold?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277107#M83573</link>
      <description>&lt;P&gt;I assume that you want output that looks something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Site        UID     Start           End             Duration
abc     123     1/2/17 12:04        1/2/2017 12:05  2:00
abc     234     1/2/17 12:08        1/2/2017 12:10  3:00
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2017 23:10:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277107#M83573</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-02-03T23:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to calculate the duration when a pressure value drops below a certain threshold?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277108#M83574</link>
      <description>&lt;P&gt;Yes that would be great and perhaps including the pressure readings for that duration as well&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 23:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277108#M83574</guid>
      <dc:creator>westonaj1</dc:creator>
      <dc:date>2017-02-03T23:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to calculate the duration when a pressure value drops below a certain threshold?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277109#M83575</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It would be great to understand why you don't want to use transaction for this? It feels like it would be well suited to the job?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where Pressure&amp;lt;3
| eval timedate=Date." ".Time
| eval _time=strptime(timedate,"%d/%m/%Y %H:%M:%S")
| transaction UID,Site maxpause=2m mvlist=t
| sort +_time,Site,UID
| eval start=min(timedate)
| eval end=max(timedate)
| eval Site=mvdedup(Site)
| eval UID=mvdedup(UID)
| eval duration=duration+60
| table Site UID start end Pressure duration
| eval duration=tostring(duration,"duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which would result in a table like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2427i4A4DA1C55C927DE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Note: As the duration field in the transaction is the elapsed time between the first and last event, you can decided if this is OK, or if you want to 'fill' it with an extra minute.&lt;/P&gt;

&lt;P&gt;For example, if you've got one pressure reading that's less than 3, was the 'duration' 0 seconds, or was it 60 seconds? It's more a preference thing on how you want to interpret your data.&lt;/P&gt;

&lt;P&gt;If anyone else has a non-transactional way, I'd be interested too.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 06:37:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277109#M83575</guid>
      <dc:creator>gvmorley</dc:creator>
      <dc:date>2017-02-05T06:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to calculate the duration when a pressure value drops below a certain threshold?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277110#M83576</link>
      <description>&lt;P&gt;Thanks for your response. Whilst transaction seems the obvious choice I was looking to see if there was a way of doing it without using transactions.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 18:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-calculate-the-duration-when-a/m-p/277110#M83576</guid>
      <dc:creator>westonaj1</dc:creator>
      <dc:date>2017-02-05T18:14:17Z</dc:date>
    </item>
  </channel>
</rss>

