<?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: earliest, latest and time variables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168960#M48222</link>
    <description>&lt;P&gt;It doesn't work.&lt;BR /&gt;
First error on info_max_time&lt;BR /&gt;
Second error on append: I cannot use two subsearches after append command.&lt;/P&gt;

&lt;P&gt;Any advice is welcome&lt;BR /&gt;
Thank you&lt;BR /&gt;
AF&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:39:19 GMT</pubDate>
    <dc:creator>antonioformato</dc:creator>
    <dc:date>2020-09-28T16:39:19Z</dc:date>
    <item>
      <title>earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168956#M48218</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I have a requirement to create a dashboard view with following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;searchString&amp;gt;
index="my_index"  publicip="'$ip$'" xxx earliest=T1 latest=T11=T1+3d"
| append 
[search index="my_index"  publicip="'$ip$'" yyy earliest=T01=T0-3d latest=T0]
| transaction framed_ip_address
| table username, privateip, publicip
&amp;lt;/searchString&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Time in Subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;T1=T0-3days
T01=earliest in time picker selection (from user)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Time in main search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; T1=latest in time picker selection (from user)
 T11=T1+3 days
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do i figure out this request?&lt;BR /&gt;
using Splunk 6.1.1.&lt;/P&gt;

&lt;P&gt;Thank you&lt;BR /&gt;
Antonio&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2014 11:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168956#M48218</guid>
      <dc:creator>antonioformato</dc:creator>
      <dc:date>2014-05-17T11:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168957#M48219</link>
      <description>&lt;P&gt;I think your T0, T1, T01, T11 specifications are a little messed up... or I'm not picking them up properly. Provide an example with actual dates for each to clarify.&lt;/P&gt;

&lt;P&gt;Additionally, describe what your actual use case is - maybe there's a less convoluted solution.&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2014 23:18:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168957#M48219</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-17T23:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168958#M48220</link>
      <description>&lt;P&gt;Hi, example with real time specification:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" sourcetype="sourcetype1" publicip="'x.x.x.x'"  freed earliest="1/20/2014:12:48:00" latest="1/23/2014:12:48:00"
| append [search index="index1" sourcetype="sourcetype1" publicip="'x.x.x.x'" assigned earliest="1/17/2014:11:48:00" latest="01/20/2014:11:48:00"]
| transaction framed_ip_address, publicportrange startswith=assigned endswith=freed 
| search index="index1" sourcetype="sourcetype1" 
| table username, acct_session_id, acct_unique_id, acct_start_time, acct_stop_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[search index=index1 
| addinfo 
| head 1 
| eval earliest=$field1.earliest$
| eval latest=$field1.earliest$+259200 
| fields earliest,latest 
| format "(" "(" "" ")" "OR" ")" ]
index="index1" sourcetype="sourcetype1" publicip="'$ip$'" freed 
| append 
[ [search index=index1
    | addinfo 
    | head 1 
    | eval earliest=$field1.earliest$-259200
    |eval latest=$field1.latest$ 
    | fields earliest,latest 
    | format "(" "(" "" ")" "OR" ")" ]
    search index="index1" sourcetype="sourcetype1" publicip="'$ip$'" assigned
]
| transaction framed_ip_address, publicportrange startswith=assigned endswith=freed
| search index="index1" sourcetype="sourcetype1"
| table username, acct_session_id, acct_unique_id, acct_start_time, acct_stop_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with last search I got error on second "head 1".&lt;BR /&gt;
Thank you&lt;BR /&gt;
Antonio&lt;/P&gt;</description>
      <pubDate>Sun, 18 May 2014 08:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168958#M48220</guid>
      <dc:creator>antonioformato</dc:creator>
      <dc:date>2014-05-18T08:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168959#M48221</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index"  publicip="'$ip$'" xxx 
[|stats count | addinfo |eval earliest=info_max_time | eval latest=relative_time(info_max_time,"+3d") 
|table earliest, latest |format "" "" "" "" "" "" ]
| append 
[search index="my_index"  publicip="'$ip$'" yyy 
[|stats count | addinfo |eval latest=info_min_time | eval earliest=relative_time(info_max_time,"-3d") 
|table earliest, latest |format "" "" "" "" "" ""]]
| transaction framed_ip_address
| table username, privateip, publicip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 May 2014 18:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168959#M48221</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-18T18:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168960#M48222</link>
      <description>&lt;P&gt;It doesn't work.&lt;BR /&gt;
First error on info_max_time&lt;BR /&gt;
Second error on append: I cannot use two subsearches after append command.&lt;/P&gt;

&lt;P&gt;Any advice is welcome&lt;BR /&gt;
Thank you&lt;BR /&gt;
AF&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:39:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168960#M48222</guid>
      <dc:creator>antonioformato</dc:creator>
      <dc:date>2020-09-28T16:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168961#M48223</link>
      <description>&lt;P&gt;You can get rid of the &lt;CODE&gt;append&lt;/CODE&gt; entirely like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" publicip="'$ip$'" [compute earliest=T0-3d and latest=T1+3d]
(
  ( xxx [compute earliest=T1 and latest=T1+3d] )
  OR
  ( yyy [compute earliest=T0-3d and latest=T0] )
)
| transaction, table, whatever
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, I'm not sure if I've used the correct T0/T1/etc values, adapt as needed.&lt;BR /&gt;
Note also the need to calculate the overall envelope of time ranges to avoid Splunk searching over all time. Having only the specific time ranges for each &lt;CODE&gt;OR&lt;/CODE&gt; branch isn't enough.&lt;/P&gt;</description>
      <pubDate>Sun, 18 May 2014 23:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168961#M48223</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-18T23:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: earliest, latest and time variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168962#M48224</link>
      <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2014 21:20:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/earliest-latest-and-time-variables/m-p/168962#M48224</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-19T21:20:14Z</dc:date>
    </item>
  </channel>
</rss>

