<?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 Time-modifiers relative to the time-picker in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289938#M3620</link>
    <description>&lt;P&gt;I have a Splunk query that returns 3 event types. I'd like the "Start" type events to be set by the time-picker and I'd like the "Stop" and "Portal" events to be driven by the time-picker plus or minus 2 days at each end. For example, if I choose the 2nd Aug for "Start" events I'd like to return the 1st to 3rd August for "Stop" and "Portal" events. Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=50 (type="Start" AND termination_cause!="Resumed" {date range A}) 
   OR (type="Stop" AND termination_cause!="Suspect-Logout" {date-range B}) 
   OR (type="Portal" view="PortalView_Process_*" {date range C})
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 15 Aug 2017 13:40:12 GMT</pubDate>
    <dc:creator>DrRich</dc:creator>
    <dc:date>2017-08-15T13:40:12Z</dc:date>
    <item>
      <title>Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289938#M3620</link>
      <description>&lt;P&gt;I have a Splunk query that returns 3 event types. I'd like the "Start" type events to be set by the time-picker and I'd like the "Stop" and "Portal" events to be driven by the time-picker plus or minus 2 days at each end. For example, if I choose the 2nd Aug for "Start" events I'd like to return the 1st to 3rd August for "Stop" and "Portal" events. Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=50 (type="Start" AND termination_cause!="Resumed" {date range A}) 
   OR (type="Stop" AND termination_cause!="Suspect-Logout" {date-range B}) 
   OR (type="Portal" view="PortalView_Process_*" {date range C})
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Aug 2017 13:40:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289938#M3620</guid>
      <dc:creator>DrRich</dc:creator>
      <dc:date>2017-08-15T13:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289939#M3621</link>
      <description>&lt;P&gt;Are you familiar with simple xml editing? I believe you could set different time ranges (as tokens) depending on the time picker setting. These tokens you could use in your search in place of date-range B or C.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 14:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289939#M3621</guid>
      <dc:creator>rvany</dc:creator>
      <dc:date>2017-08-15T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289940#M3622</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
*&lt;EM&gt;Updated  (added format command to resolve search time error) *&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=50 (type="Start" AND termination_cause!="Resumed") 
    OR (type="Stop" AND termination_cause!="Suspect-Logout" [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-2d@d") | eval latest=relative_time(info_min_time,"+2d@d") | table earliest latest | format "" "" "" "" "" ""]) 
    OR (type="Portal" view="PortalView_Process_*" [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-2d@d") | eval latest=relative_time(info_min_time,"+2d@d") | table earliest latest  | format "" "" "" "" "" ""])
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Aug 2017 14:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289940#M3622</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-15T14:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289941#M3623</link>
      <description>&lt;P&gt;Thanks for this. I seem to be getting an error when I try and run this search it says:&lt;/P&gt;

&lt;P&gt;Error in 'search' command: Unable to parse the search: 'AND' operator is missing a clause on the left hand side.&lt;/P&gt;

&lt;P&gt;Am I missing something?&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289941#M3623</guid>
      <dc:creator>DrRich</dc:creator>
      <dc:date>2017-08-16T13:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289942#M3624</link>
      <description>&lt;P&gt;I have looked at this but it won't work for my use case as I am passing the query to Splunk via the js stack from a third party application. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289942#M3624</guid>
      <dc:creator>DrRich</dc:creator>
      <dc:date>2017-08-16T13:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289943#M3625</link>
      <description>&lt;P&gt;Maybe you are missing a quote so the syntax isn't correct? Are both ANDs coloured?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:42:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289943#M3625</guid>
      <dc:creator>rvany</dc:creator>
      <dc:date>2017-08-16T13:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289944#M3626</link>
      <description>&lt;P&gt;I've made some progress and I've now got the script to run (see below) but the output isn't what I was expecting.  It appears that the time picker is overriding the time ranges set for the "Stop" and "Portal" events, so if I select yesterday (15th Aug) only events that occurred on the 15th for all three types are returned.  I've also included a screenshot of the output.  Any Ideas?&lt;/P&gt;

&lt;P&gt;Thanks&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/3387i42DDE3F9970B0D8A/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;PRE&gt;&lt;CODE&gt;index=50 (type="Start" AND termination_cause!="Resumed") 
     OR (type="Stop" AND termination_cause!="Suspect-Logout" [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-2d@d") | eval latest=relative_time(info_min_time,"+2d@d") | table earliest latest | format "" "" "" "" "" ""]) 
     OR (type="Portal" view="PortalView_Process_*" [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-2d@d") | eval latest=relative_time(info_min_time,"+2d@d") | table earliest latest | format "" "" "" "" "" ""])
  | eval session_start_time_unix=if(type="Start",_time,"")
  | eval session_stop_time_unix=if(type="Stop",_time,"")
  | eval session_portal_time_unix=if(type="Portal",_time,"")
  | eval session_start_time=strftime(session_start_time_unix,"%Y/%m/%d %H:%M:%S")
  | eval session_stop_time=strftime(session_stop_time_unix,"%Y/%m/%d %H:%M:%S")
  | eval session_portal_time=strftime(session_portal_time_unix,"%Y/%m/%d %H:%M:%S")
  | stats min(session_start_time) as earliest_start_time, max(session_start_time) as latest_start_time, min(session_stop_time) as earliest_stop_time, max(session_stop_time) as latest_stop_time, min(session_portal_time) as earliest_portal_time, max(session_portal_time) as latest_portal_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Aug 2017 14:21:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289944#M3626</guid>
      <dc:creator>DrRich</dc:creator>
      <dc:date>2017-08-16T14:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289945#M3627</link>
      <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 15:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289945#M3627</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-16T15:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289946#M3628</link>
      <description>&lt;P&gt;Thanks for this, it now runs but the time picker is overriding the time ranges set for the "Stop" and "Portal" events, so if I select yesterday (15th Aug) only events that occurred on the 15th for all three types are returned (see my update below). Any ideas as I'm out of them now.  Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 18:57:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289946#M3628</guid>
      <dc:creator>DrRich</dc:creator>
      <dc:date>2017-08-16T18:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Time-modifiers relative to the time-picker</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289947#M3629</link>
      <description>&lt;P&gt;Just some kind off feedback - I tried a partial search taken from your current one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=syslogs [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-2d@d") | eval latest=relative_time(info_min_time,"+2d@d") | table earliest latest | format "" "" "" "" "" ""]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works as expected. I tried as a normal search and also as a report.&lt;/P&gt;

&lt;P&gt;BTW [OT]: could you tell me how to format code with line numbers?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 19:34:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Time-modifiers-relative-to-the-time-picker/m-p/289947#M3629</guid>
      <dc:creator>rvany</dc:creator>
      <dc:date>2017-08-16T19:34:54Z</dc:date>
    </item>
  </channel>
</rss>

