<?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 parse a timestamp field from a user text input to use for the search time range? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250316#M74752</link>
    <description>&lt;P&gt;Splunk 6.3 what about you?&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2016 22:38:31 GMT</pubDate>
    <dc:creator>brianlee12</dc:creator>
    <dc:date>2016-07-08T22:38:31Z</dc:date>
    <item>
      <title>How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250307#M74743</link>
      <description>&lt;P&gt;Hi guys, &lt;/P&gt;

&lt;P&gt;So I have an input field where the user inputs text in the format &lt;CODE&gt;%y%m%d%H%M&lt;/CODE&gt;, for example &lt;CODE&gt;1607061700&lt;/CODE&gt;, which would be July 6th, 2016 5:00 PM. I would like to parse this input and set my search time range to be an hour before and 5 hours after this time. I've tried using subsearches and messing with the XML, but can't seem to get anything to work. Any help would be greatly appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 17:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250307#M74743</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T17:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250308#M74744</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text"&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="e"&amp;gt;strptime($value$, "%y%m%d%H%M")-3600&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="l"&amp;gt;strptime($value$, "%y%m%d%H%M")+18000&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
&amp;lt;input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your search query, use &lt;CODE&gt;earliest=$e$ latest=$l$&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 18:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250308#M74744</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T18:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250309#M74745</link>
      <description>&lt;P&gt;For some reason, the resulting e and l values are earliest=946710000 latest=946731600 which translates to (12/31/99 11:00:00.000 PM to 1/1/00 5:00:00.000 AM). Not sure why strptime isn't parsing this correctly.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 21:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250309#M74745</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T21:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250310#M74746</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;eval token="e"&amp;gt;relative_time(strptime($value$, "%y%m%d%H%M"), "-1h")&amp;lt;/eval&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jul 2016 21:31:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250310#M74746</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T21:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250311#M74747</link>
      <description>&lt;P&gt;Still the same result. The issue is with strptime not parsing the input correctly. strptime($value$, "%y%m%d%H%M") produces  1/1/00 12:00:00.000 AM which I'm assuming is the default or starting time.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:12:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250311#M74747</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T22:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250312#M74748</link>
      <description>&lt;P&gt;Just did a little debugging. The issue is with the $value$ token which currently carries the value of null for some reason.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:23:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250312#M74748</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T22:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250313#M74749</link>
      <description>&lt;P&gt;I just tried this and I get right results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;form&amp;gt;
      &amp;lt;label&amp;gt;Test Dashboard&amp;lt;/label&amp;gt;
      &amp;lt;fieldset submitButton="false"&amp;gt;
        &amp;lt;input type="text" token="t"&amp;gt;
          &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
          &amp;lt;default&amp;gt;1607061700&amp;lt;/default&amp;gt;
          &amp;lt;change&amp;gt;
            &amp;lt;eval token="e"&amp;gt;relative_time(strptime($value$, "%y%m%d%H%M"), "-1h")&amp;lt;/eval&amp;gt;
            &amp;lt;eval token="l"&amp;gt;strptime($value$, "%y%m%d%H%M")+18000&amp;lt;/eval&amp;gt;
          &amp;lt;/change&amp;gt;
        &amp;lt;/input&amp;gt;
      &amp;lt;/fieldset&amp;gt;
      &amp;lt;row&amp;gt;
        &amp;lt;panel&amp;gt;
          &amp;lt;table&amp;gt;
            &amp;lt;title&amp;gt;$e$ ($l$)&amp;lt;/title&amp;gt;
            &amp;lt;search&amp;gt;
              &amp;lt;query&amp;gt;| gentimes start=-1 | eval x="$e$" | eval y="$l$" | eval z=strftime(x, "%y-%m-%d %H:%M") | eval a=strftime(y, "%y-%m-%d %H:%M") | table x y z a&amp;lt;/query&amp;gt;
              &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
              &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
            &amp;lt;/search&amp;gt;
          &amp;lt;/table&amp;gt;
        &amp;lt;/panel&amp;gt;
      &amp;lt;/row&amp;gt;
    &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:27:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250313#M74749</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T22:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250314#M74750</link>
      <description>&lt;P&gt;Copy and pasted that into my dashboard and didn't work for me. Not sure why it could be something to do with splunk settings.&lt;IMG src="https://dl.dropboxusercontent.com/u/30186985/Screen%20Shot%202016-07-08%20at%203.32.55%20PM.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250314#M74750</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T22:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250315#M74751</link>
      <description>&lt;P&gt;which splunk version?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:37:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250315#M74751</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T22:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250316#M74752</link>
      <description>&lt;P&gt;Splunk 6.3 what about you?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:38:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250316#M74752</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T22:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250317#M74753</link>
      <description>&lt;P&gt;I have version 6.4. Shouldn't make any difference. I tried using &lt;CODE&gt;$t$&lt;/CODE&gt; (token name for the text box) instead of &lt;CODE&gt;$value$&lt;/CODE&gt;, and I get the incorrect date. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:50:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250317#M74753</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T22:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250318#M74754</link>
      <description>&lt;P&gt;Yeah I'm really not sure why $value$ is giving me null. $t$ and $t.value$ also don't work for me.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250318#M74754</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T22:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250319#M74755</link>
      <description>&lt;P&gt;Try using &lt;CODE&gt;$t$&lt;/CODE&gt; in the panel's search. See if you get the value there.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250319#M74755</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T22:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250320#M74756</link>
      <description>&lt;P&gt;using $t$ in the search query works for me&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:00:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250320#M74756</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T23:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250321#M74757</link>
      <description>&lt;P&gt;Do you know any other way of doing this that might work?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250321#M74757</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T23:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250322#M74758</link>
      <description>&lt;P&gt;Since the &lt;CODE&gt;$value$&lt;/CODE&gt; is not working, try this approach in your panel's search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xyz  [| gentimes start=-1 | eval earliest=relative_time(strptime($t$, "%y%m%d%H%M"), "-1h") | eval latest=relative_time(strptime($t$, "%y%m%d%H%M"), "+5h") | table earliest latest]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:08:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250322#M74758</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T23:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a timestamp field from a user text input to use for the search time range?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250323#M74759</link>
      <description>&lt;P&gt;Fixed the problem. Using value with no $ around it worked for me.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:08:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-a-timestamp-field-from-a-user-text-input-to-use-for/m-p/250323#M74759</guid>
      <dc:creator>brianlee12</dc:creator>
      <dc:date>2016-07-08T23:08:25Z</dc:date>
    </item>
  </channel>
</rss>

